Пример #1
0
        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);
        }
Пример #2
0
        public static bool AreCommentsEnabled(this Webpage webpage, CommentingInfo commentingInfo, CommentingSettings settings)
        {
            if (webpage == null || settings == null)
            {
                return(false);
            }

            if (commentingInfo != null)
            {
                if (commentingInfo.CommentingEnabledStatus != CommentingEnabledStatus.System)
                {
                    return(commentingInfo.CommentingEnabledStatus == CommentingEnabledStatus.Enabled);
                }
            }

            return(settings.AllowedTypes.Contains(webpage.GetType()));
        }