public CommentsViewInfo GetAddCommentsInfo(Webpage webpage) { if (!webpage.AreCommentsEnabled(_getWebpageCommentingInfo.Get(webpage), _settings)) { return(new CommentsViewInfo { Disabled = true }); } if (!_settings.AllowGuestComments && CurrentRequestData.CurrentUser == null) { return(new CommentsViewInfo { View = "Login", Model = new LoginModel(), }); } if (CurrentRequestData.CurrentUser == null) { return(new CommentsViewInfo { View = "Guest", Model = new GuestAddCommentModel { WebpageId = webpage.Id }, }); } return(new CommentsViewInfo { View = "LoggedIn", Model = new LoggedInUserAddCommentModel { WebpageId = webpage.Id }, }); }
public override object GetModel(CurrentPageCommentsWidget widget) { Webpage currentPage = CurrentRequestData.CurrentPage; if (currentPage == null) { return(null); } CommentingInfo commentingInfo = _getWebpageCommentingInfo.Get(currentPage); if (!currentPage.AreCommentsEnabled(commentingInfo, _commentingSettings)) { return(null); } return(currentPage); }
public override void Execute(IEnumerable <UpdateCommentingInfoData> data) { _session.Transact(session => { foreach (var infoData in data) { var webpage = session.Get <Webpage>(infoData.WebpageId); var commentingInfo = _getWebpageCommentingInfo.Get(webpage); if (commentingInfo == null) { return; } commentingInfo.CommentingEnabledStatus = infoData.Status; session.Update(commentingInfo); } }); }
private CommentingInfo GetCommentingInfo(Webpage webpage) { return(_getWebpageCommentingInfo.Get(webpage)); }