protected override async Task OnParametersSetAsync() { Forums = new ForumsModel(NodeService) { NodeSearch = new NodeSearch() { Module = Constants.ForumsModule, Type = Constants.ForumType, Path = Path, OrderBy = new string[] { OrderBy.Title }, RootOnly = true } }; await Forums.InitAsync(); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); CanAddForum = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ForumsModule, Constants.ForumType, Actions.Add ); }
protected override async Task OnParametersSetAsync() { var configSearch = new NodeSearch() { Module = Constants.ForumsModule, Type = Constants.ConfigType }; var configNodes = (await NodeService.GetAsync(configSearch, 0)); if (configNodes.Length > 0) { Config = configNodes[0]; } Forums = new ForumsModel(NodeService) { NodeSearch = new NodeSearch() { Module = Constants.ForumsModule, Type = Constants.ForumType, OrderBy = $"{OrderBy.Title}", RootOnly = true, TruncateContent = 140 } }; await Forums.InitAsync(); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); CanEditConfig = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ForumsModule, Constants.ConfigType, Actions.Edit ); CanAddForum = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ForumsModule, Constants.ForumType, Actions.Add ); }
protected override async Task OnParametersSetAsync() { var node = await NodeService.GetBySlugAsync( Constants.ForumsModule, Constants.ForumType, Slug); Forum = Models.Forum.Create(node); var createdBy = node.CreatedBy; if (!string.IsNullOrEmpty(Forum.ParentId)) { var parentNode = await NodeService.GetAsync(Forum.ParentId); if (parentNode != null) { ParentForum = Models.Forum.Create(parentNode); } } else { ParentForum = null; } Forums = new ForumsModel(NodeService) { NodeSearch = new NodeSearch() { Module = Constants.ForumsModule, Type = Constants.ForumType, OrderBy = new string[] { OrderBy.Title }, ParentId = node.Id } }; await Forums.InitAsync(); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); CanAddForum = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ForumsModule, Constants.ForumType, Actions.Add ); Topics = new TopicsModel(NodeService) { NodeSearch = new NodeSearch() { Module = Constants.ForumsModule, Type = Constants.TopicType, ParentId = node.Id, OrderBy = new string[] { OrderBy.Hot, OrderBy.Latest } } }; await Topics.InitAsync(); CanEditForum = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ForumsModule, Constants.ForumType, Actions.Edit ); CanDeleteForum = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ForumsModule, Constants.ForumType, Actions.Delete ); CanAddTopic = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ForumsModule, Constants.TopicType, Actions.Add ); }