예제 #1
0
        public async Task <PostEdit> GetPostForEdit(Post post, User user)
        {
            if (post == null)
            {
                throw new ArgumentNullException(nameof(post));
            }
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }
            var profile = await _profileRepository.GetProfile(user.UserID);

            var postEdit = new PostEdit(post)
            {
                IsPlainText = profile.IsPlainText, IsFirstInTopic = post.IsFirstInTopic
            };

            if (profile.IsPlainText)
            {
                postEdit.FullText    = _textParsingService.HtmlToForumCode(post.FullText);
                postEdit.IsPlainText = true;
            }
            else
            {
                postEdit.FullText = _textParsingService.HtmlToClientHtml(post.FullText);
            }
            return(postEdit);
        }
예제 #2
0
        public PostEdit GetPostForEdit(Post post, User user, bool isMobile)
        {
            if (post == null)
            {
                throw new ArgumentNullException("post");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            var profile  = _profileRepository.GetProfile(user.UserID);
            var postEdit = new PostEdit(post)
            {
                IsPlainText = profile.IsPlainText
            };

            if (profile.IsPlainText || isMobile)
            {
                postEdit.FullText    = _textParsingService.HtmlToForumCode(post.FullText);
                postEdit.IsPlainText = true;
            }
            else
            {
                postEdit.FullText = _textParsingService.HtmlToClientHtml(post.FullText);
            }
            return(postEdit);
        }