private ActionResult RenderGroupNavigation() { var groupId = Request.QueryString.GetGroupIdOrNone(); var validGroup = groupId.Map(_groupService.Get); return(validGroup.Match( Some: group => { var groupNavigationModel = group.IsHidden ? new GroupNavigationViewModel { GroupTitle = group.Title } : new GroupNavigationViewModel { GroupTitle = group.Title, GroupUrl = _groupLinkProvider.GetGroupLink(group.Id), ActivityTabs = _groupFeedContentService .GetMainFeedTab(CurrentPage, group.Id) .ToEnumerable() .Map <IEnumerable <GroupNavigationActivityTabViewModel> >(), PageTabs = _groupFeedContentService .GetPageTabs(CurrentPage, group.Id) .Select(t => MapToGroupPageTabViewModel(t, _groupContentProvider.GetEditPage())) .ToList() }; return PartialView(GroupNavigationViewPath, groupNavigationModel); }, None: () => (ActionResult) new EmptyResult())); }
private Func <IPublishedContent, bool> GetPageSkipResolver(IIntranetUser user, Guid groupId) { var canEdit = _groupService.CanEdit(groupId, user); var editGroupPage = _contentProvider.GetEditPage(); var deactivatedPage = _contentProvider.GetDeactivatedGroupPage(); bool SkipPage(IPublishedContent content) => !canEdit && AreSamePages(editGroupPage, content) || AreSamePages(deactivatedPage, content); return(SkipPage); }
private ActionResult RenderGroupNavigation() { var groupId = Request.QueryString.GetGroupId(); if (!groupId.HasValue) { return(new EmptyResult()); } var group = _groupService.Get(groupId.Value); if (group == null) { return(new EmptyResult()); } var groupNavigationModel = new GroupNavigationViewModel { GroupTitle = @group.Title }; if (!group.IsHidden) { groupNavigationModel.GroupUrl = _groupLinkProvider.GetGroupLink(group.Id); groupNavigationModel.ActivityTabs = _groupFeedContentService .GetMainFeedTab(CurrentPage, groupId.Value) .ToEnumerable() .Map <IEnumerable <GroupNavigationActivityTabViewModel> >(); var currentUser = _intranetUserService.GetCurrentUser(); var groupEditPage = _groupContentProvider.GetEditPage(); groupNavigationModel.PageTabs = _groupFeedContentService .GetPageTabs(CurrentPage, currentUser, groupId.Value) .Select(t => MapToGroupPageTabViewModel(t, groupEditPage)); } return(PartialView(GroupNavigationViewPath, groupNavigationModel)); }