Beispiel #1
0
        public ActionResult ReportedComments(string subName)
        {
            ViewBag.ManageNavigationKey = "reportedcomments";

            if (string.IsNullOrEmpty(subName))
            {
                throw new NotFoundException();
            }

            var sub = _subDao.GetSubByName(subName);

            if (sub == null)
            {
                throw new NotFoundException();
            }

            if (!_permissionDao.CanUserManageSubPosts(_userContext.CurrentUser, sub.Id))
            {
                throw new UnauthorizedException();
            }

            var commentIds = _commentDao.GetReportedComments(new List <Guid> {
                sub.Id
            }, take: 30);

            var model = new ReportedCommentsViewModel();

            model.Sub      = sub;
            model.Comments = new PagedList <CommentWrapped>(_commentWrapper.Wrap(commentIds, _userContext.CurrentUser), 0, 30, commentIds.HasMore);

            return(View(model));
        }