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

            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 postIds = _postDao.GetReportedPosts(new List <Guid> {
                sub.Id
            }, take: 30);

            var model = new ReportedPostsViewModel();

            model.Sub   = sub;
            model.Posts = new PagedList <PostWrapped>(_postWrapper.Wrap(postIds, _userContext.CurrentUser), 0, 30, postIds.HasMore);

            return(View(model));
        }