public HttpResponseMessage CommentSave(CommentSaveDTO postData) { try { var comment = Utilities.RemoveHTML(HttpUtility.UrlDecode(postData.Comment)); IDictionary <string, UserInfo> mentionedUsers = new Dictionary <string, UserInfo>(); var originalComment = comment; comment = ParseMentions(comment, postData.Mentions, ref mentionedUsers); var ci = new CommentInfo { JournalId = postData.JournalId, Comment = comment }; ci.UserId = UserInfo.UserID; ci.DisplayName = UserInfo.DisplayName; JournalController.Instance.SaveComment(ci); var ji = JournalController.Instance.GetJournalItem(ActiveModule.OwnerPortalID, UserInfo.UserID, postData.JournalId); var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, ji.ProfileId, -1, UserInfo); SendMentionNotifications(mentionedUsers, ji, originalComment, "Comment"); return(Request.CreateResponse(HttpStatusCode.OK, jp.GetCommentRow(ji, ci), "text/html")); } catch (Exception exc) { Logger.Error(exc); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc)); } }
public HttpResponseMessage CommentSave(CommentSaveDTO postData) { try { var ci = new CommentInfo { JournalId = postData.JournalId, Comment = HttpUtility.UrlDecode(postData.Comment) }; if (ci.Comment.Length > 2000) { ci.Comment = ci.Comment.Substring(0, 1999); ci.Comment = Utilities.RemoveHTML(ci.Comment); } ci.UserId = UserInfo.UserID; JournalController.Instance.SaveComment(ci); var ji = JournalController.Instance.GetJournalItem(ActiveModule.OwnerPortalID, UserInfo.UserID, postData.JournalId); var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, ji.ProfileId, -1, UserInfo); return(Request.CreateResponse(HttpStatusCode.OK, jp.GetCommentRow(ci), "text/html")); } catch (Exception exc) { Logger.Error(exc); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc)); } }
public string CommentSave(int journalId, string comment) { try { var ci = new CommentInfo { JournalId = journalId, Comment = HttpUtility.UrlDecode(comment) }; if (ci.Comment.Length > 2000) { ci.Comment = ci.Comment.Substring(0, 1999); ci.Comment = Utilities.RemoveHTML(ci.Comment); } ci.UserId = UserInfo.UserID; InternalJournalController.Instance.SaveComment(ci); var ji = JournalController.Instance.GetJournalItem(PortalSettings.PortalId, UserInfo.UserID, journalId); var jp = new JournalParser(PortalSettings, ActiveModule.ModuleID, ji.ProfileId, -1, UserInfo); return(jp.GetCommentRow(ci)); } catch (Exception exc) { DnnLog.Error(exc); return(string.Empty); } }