예제 #1
0
        private void SendNewCommentEmail(Post post, PostComments.Comment comment)
        {
            var viewModel = comment.MapTo<NewCommentEmailViewModel>();
            viewModel.PostId = RavenIdResolver.Resolve(post.Id);
            viewModel.PostTitle = post.Title;
            viewModel.BlogName = Session.Load<BlogConfig>("Blog/Config").Title;

            var subject = string.Format("Comment on: {0} from {1}", viewModel.PostTitle, viewModel.BlogName);

            if(comment.IsSpam)
                subject = "Spam " + subject;

            CommandExecutor.ExcuteLater(new SendEmailCommand(viewModel.Email,subject, "NewComment", viewModel));
        }
예제 #2
0
        private void SendNewCommentEmail(Post post, PostComments.Comment comment, User postAuthor)
        {
            if (_requestValues.IsAuthenticated)
                return; // we don't send email for authenticated users

            var viewModel = comment.MapTo<NewCommentEmailViewModel>();
            viewModel.PostId = RavenIdResolver.Resolve(post.Id);
            viewModel.PostTitle = HttpUtility.HtmlDecode(post.Title);
            viewModel.PostSlug = SlugConverter.TitleToSlug(post.Title);
            viewModel.BlogName = DocumentSession.Load<BlogConfig>("Blog/Config").Title;
            viewModel.Key = post.ShowPostEvenIfPrivate.MapTo<string>();

            var subject = string.Format("{2}Comment on: {0} from {1}", viewModel.PostTitle, viewModel.BlogName, comment.IsSpam ? "[Spam] " : string.Empty);

            TaskExecutor.ExcuteLater(new SendEmailTask(viewModel.Email, subject, "NewComment", postAuthor.Email, viewModel));
        }
예제 #3
0
        private void SendNewCommentEmail(Post post, PostComments.Comment comment)
        {
            if (_requestValues.IsAuthenticated)
                return; // we don't send email for authenticated users

            var viewModel = comment.MapTo<NewCommentEmailViewModel>();
            viewModel.PostId = RavenIdResolver.Resolve(post.Id);
            viewModel.PostTitle = HttpUtility.HtmlDecode(post.Title);
            viewModel.BlogName = Session.Load<BlogConfig>("Blog/Config").Title;

            var subject = string.Format("Comment on: {0} from {1}", viewModel.PostTitle, viewModel.BlogName);

            if(comment.IsSpam)
                subject = "Spam " + subject;

            CommandExecutor.ExcuteLater(new SendEmailCommand(viewModel.Email,subject, "NewComment", viewModel));
        }