+ constructor (
+ private auth: AuthService,
+ private screen: ScreenService
+ ) { }
+
+ get isBroadcastMessageDisplayed () {
+ return this.screen.isBroadcastMessageDisplayed
+ }
+
+ ngOnInit () {
+ this.buildOverviewItems()
+ this.buildFederationItems()
+ this.buildModerationItems()
+ this.buildConfigurationItems()
+ this.buildPluginItems()
+ this.buildSystemItems()
+ }
+
+ private buildOverviewItems () {
+ if (this.hasUsersRight()) {
+ this.menuEntries.push({ label: $localize`Users`, routerLink: '/admin/users' })
+ }
+ }
+
+ private buildFederationItems () {
+ if (!this.hasServerFollowRight()) return
+
+ this.menuEntries.push({
+ label: $localize`Federation`,
+ children: [
+ {
+ label: $localize`Following`,
+ routerLink: '/admin/follows/following-list',
+ iconName: 'following'
+ },
+ {
+ label: $localize`Followers`,
+ routerLink: '/admin/follows/followers-list',
+ iconName: 'follower'
+ },
+ {
+ label: $localize`Video redundancies`,
+ routerLink: '/admin/follows/video-redundancies-list',
+ iconName: 'videos'
+ }
+ ]
+ })
+ }
+
+ private buildModerationItems () {
+ const moderationItems: TopMenuDropdownParam = {
+ label: $localize`Moderation`,
+ children: []
+ }
+
+ if (this.hasAbusesRight()) {
+ moderationItems.children.push({
+ label: $localize`Reports`,
+ routerLink: '/admin/moderation/abuses/list',
+ iconName: 'flag'
+ })
+ }
+
+ if (this.hasVideoBlocklistRight()) {
+ moderationItems.children.push({
+ label: $localize`Video blocks`,
+ routerLink: '/admin/moderation/video-blocks/list',
+ iconName: 'cross'
+ })
+ }
+
+ if (this.hasVideoCommentsRight()) {
+ moderationItems.children.push({
+ label: $localize`Video comments`,
+ routerLink: '/admin/moderation/video-comments/list',
+ iconName: 'message-circle'
+ })
+ }
+
+ if (this.hasAccountsBlocklistRight()) {
+ moderationItems.children.push({
+ label: $localize`Muted accounts`,
+ routerLink: '/admin/moderation/blocklist/accounts',
+ iconName: 'user-x'
+ })
+ }
+
+ if (this.hasServersBlocklistRight()) {
+ moderationItems.children.push({
+ label: $localize`Muted servers`,
+ routerLink: '/admin/moderation/blocklist/servers',
+ iconName: 'peertube-x'
+ })
+ }
+
+ if (moderationItems.children.length !== 0) this.menuEntries.push(moderationItems)
+ }
+
+ private buildConfigurationItems () {
+ if (this.hasConfigRight()) {
+ this.menuEntries.push({ label: $localize`Configuration`, routerLink: '/admin/config' })
+ }
+ }
+
+ private buildPluginItems () {
+ if (this.hasPluginsRight()) {
+ this.menuEntries.push({ label: $localize`Plugins/Themes`, routerLink: '/admin/plugins' })
+ }
+ }
+
+ private buildSystemItems () {
+ const systemItems: TopMenuDropdownParam = {
+ label: $localize`System`,
+ children: []
+ }
+
+ if (this.hasJobsRight()) {
+ systemItems.children.push({
+ label: $localize`Jobs`,
+ iconName: 'circle-tick',
+ routerLink: '/admin/system/jobs'
+ })
+ }
+
+ if (this.hasLogsRight()) {
+ systemItems.children.push({
+ label: $localize`Logs`,
+ iconName: 'playlists',
+ routerLink: '/admin/system/logs'
+ })
+ }
+
+ if (this.hasDebugRight()) {
+ systemItems.children.push({
+ label: $localize`Debug`,
+ iconName: 'cog',
+ routerLink: '/admin/system/debug'
+ })
+ }
+
+ if (systemItems.children.length !== 0) {
+ this.menuEntries.push(systemItems)
+ }
+ }
+
+ private hasUsersRight () {