public void MemberReport(Report report) { var sb = new StringBuilder(); var email = new Email(); sb.AppendFormat("<p>{2}: <a href=\"{0}\">{1}</a></p>", string.Concat(Dialogue.Settings().ForumRootUrlWithDomain, report.Reporter.Url), report.Reporter.UserName, AppHelpers.Lang("Report.Reporter")); sb.AppendFormat("<p>{2}: <a href=\"{0}\">{1}</a></p>", string.Concat(Dialogue.Settings().ForumRootUrlWithDomain, report.ReportedMember.Url), report.ReportedMember.UserName, AppHelpers.Lang("Report.MemberReported")); sb.AppendFormat("<p>{0}:</p>", AppHelpers.Lang("Report.Reason")); sb.AppendFormat("<p>{0}</p>", report.Reason); email.EmailFrom = Dialogue.Settings().NotificationReplyEmailAddress; email.EmailTo = Dialogue.Settings().AdminEmailAddress; email.Subject = AppHelpers.Lang("Report.MemberReport"); email.NameTo = AppHelpers.Lang("Report.Admin"); email.Body = ServiceFactory.EmailService.EmailTemplate(email.NameTo, sb.ToString()); ServiceFactory.EmailService.SendMail(email); }
public ActionResult Report(ReportMemberViewModel viewModel) { if (Settings.EnableMemberReporting) { using (UnitOfWorkManager.NewUnitOfWork()) { var user = ServiceFactory.MemberService.Get(viewModel.MemberId); // Banned link? if (ServiceFactory.BannedLinkService.ContainsBannedLink(viewModel.Reason)) { ShowMessage(new GenericMessageViewModel { Message = Lang("Errors.BannedLink"), MessageType = GenericMessages.Danger }); return Redirect(user.Url); } var report = new Report { Reason = viewModel.Reason, ReportedMember = user, Reporter = CurrentMember }; ServiceFactory.ReportService.MemberReport(report); ShowMessage(new GenericMessageViewModel { Message = Lang("Report.ReportSent"), MessageType = GenericMessages.Success }); return Redirect(user.Url); } } return ErrorToHomePage(Lang("Errors.GenericMessage")); }
public ActionResult Report(ReportPostViewModel viewModel) { if (Settings.EnableSpamReporting) { using (UnitOfWorkManager.NewUnitOfWork()) { var post = ServiceFactory.PostService.Get(viewModel.PostId); // Banned link? if (ServiceFactory.BannedLinkService.ContainsBannedLink(viewModel.Reason)) { ShowMessage(new GenericMessageViewModel { Message = Lang("Errors.BannedLink"), MessageType = GenericMessages.Danger }); return Redirect(post.Topic.Url); } var report = new Report { Reason = viewModel.Reason, ReportedPost = post, Reporter = CurrentMember }; ServiceFactory.ReportService.PostReport(report); var message= new GenericMessageViewModel { Message = Lang("Report.ReportSent"), MessageType = GenericMessages.Success }; ShowMessage(message); return Redirect(post.Topic.Url); } } return ErrorToHomePage(Lang("Errors.GenericMessage")); }