// POST /api/forummod public ModerationResult Post(ModerationRequest modReq) { //log.Info("cmd = " + modReq.Cmd); //log.Info("pageId = " + modReq.PageId.ToInvariantString()); //log.Info("moduleId = " + modReq.ModuleId.ToInvariantString()); //log.Info("pageNumber = " + modReq.PageNumber.ToInvariantString()); //log.Info("threadId = " + modReq.ThreadId.ToInvariantString()); //log.Info("postId = " + modReq.PostId.ToInvariantString()); ModerationResult result = new ModerationResult(); result.Msg = "rejected"; if (IsAllowed(modReq)) { switch (modReq.Cmd) { case "sendnotification": bool notifyModeratorOnly = false; ForumNotification.NotifySubscribers( forum, thread, module, postUser, siteSettings, config, SiteUtils.GetNavigationSiteRoot(), modReq.PageId, modReq.PageNumber, SiteUtils.GetDefaultCulture(), ForumConfiguration.GetSmtpSettings(), notifyModeratorOnly ); thread.NotificationSent = true; thread.UpdatePost(); result.Msg = "success"; break; case "marksent": thread.NotificationSent = true; thread.UpdatePost(); //System.Threading.Thread.Sleep(7000); result.Msg = "success"; break; } } return(result); }
private void SendNotification(HttpContext context) { //log.Info("theadId = " + threadId); //log.Info("postId = " + postId); //log.Info("pageId = " + pageId); //log.Info("mid = " + moduleId); bool notifyModeratorOnly = false; ModResult result = new ModResult(); if (LoadAndValidateForumObjects()) { thread.NotificationSent = true; thread.UpdatePost(); ForumNotification.NotifySubscribers( forum, thread, module, postUser, siteSettings, config, SiteUtils.GetNavigationSiteRoot(), pageId, pageNumber, SiteUtils.GetDefaultCulture(), ForumConfiguration.GetSmtpSettings(), notifyModeratorOnly ); result.Msg = "success"; } else { log.Info("Send forum notification request rejected due to invalid params"); result.Msg = "rejected"; } context.Response.ContentType = "application/json"; JavaScriptSerializer s = new JavaScriptSerializer(); context.Response.Write(s.Serialize(result)); }