}
ngOnInit () {
- const federationItems: TopMenuDropdownParam = {
+ this.buildOverviewItems()
+ this.buildFederationItems()
+ this.buildModerationItems()
+ this.buildConfigurationItems()
+ this.buildPluginItems()
+ this.buildSystemItems()
+ }
+
+ private buildOverviewItems () {
+ const overviewItems: TopMenuDropdownParam = {
+ label: $localize`Overview`,
+ children: []
+ }
+
+ if (this.hasUsersRight()) {
+ overviewItems.children.push({
+ label: $localize`Users`,
+ routerLink: '/admin/users',
+ iconName: 'user'
+ })
+ }
+
+ if (this.hasVideosRight()) {
+ overviewItems.children.push({
+ label: $localize`Videos`,
+ routerLink: '/admin/videos',
+ iconName: 'videos'
+ })
+ }
+
+ if (this.hasVideoCommentsRight()) {
+ overviewItems.children.push({
+ label: $localize`Comments`,
+ routerLink: '/admin/comments',
+ iconName: 'message-circle'
+ })
+ }
+
+ if (overviewItems.children.length !== 0) {
+ this.menuEntries.push(overviewItems)
+ }
+ }
+
+ private buildFederationItems () {
+ if (!this.hasServerFollowRight()) return
+
+ this.menuEntries.push({
label: $localize`Federation`,
children: [
{
iconName: 'videos'
}
]
- }
+ })
+ }
+ private buildModerationItems () {
const moderationItems: TopMenuDropdownParam = {
label: $localize`Moderation`,
children: []
iconName: 'flag'
})
}
+
if (this.hasVideoBlocklistRight()) {
moderationItems.children.push({
label: $localize`Video blocks`,
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`,
iconName: 'user-x'
})
}
+
if (this.hasServersBlocklistRight()) {
moderationItems.children.push({
label: $localize`Muted servers`,
})
}
- if (this.hasUsersRight()) {
- this.menuEntries.push({ label: $localize`Users`, routerLink: '/admin/users' })
- }
-
- if (this.hasServerFollowRight()) this.menuEntries.push(federationItems)
- if (this.hasAbusesRight() || this.hasVideoBlocklistRight()) this.menuEntries.push(moderationItems)
+ 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' })
}
+ }
- if (this.hasJobsRight() || this.hasLogsRight() || this.hasDebugRight()) {
- this.menuEntries.push({ label: $localize`System`, routerLink: '/admin/system' })
+ 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)
}
}
- hasUsersRight () {
+ private hasUsersRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_USERS)
}
- hasServerFollowRight () {
+ private hasServerFollowRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_SERVER_FOLLOW)
}
- hasAbusesRight () {
+ private hasAbusesRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_ABUSES)
}
- hasVideoBlocklistRight () {
+ private hasVideoBlocklistRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
}
- hasAccountsBlocklistRight () {
+ private hasAccountsBlocklistRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)
}
- hasServersBlocklistRight () {
+ private hasServersBlocklistRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)
}
- hasConfigRight () {
+ private hasConfigRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_CONFIGURATION)
}
- hasPluginsRight () {
+ private hasPluginsRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_PLUGINS)
}
- hasLogsRight () {
+ private hasLogsRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_LOGS)
}
- hasJobsRight () {
+ private hasJobsRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_JOBS)
}
- hasDebugRight () {
+ private hasDebugRight () {
return this.auth.getUser().hasRight(UserRight.MANAGE_DEBUG)
}
- hasVideoCommentsRight () {
+ private hasVideoCommentsRight () {
return this.auth.getUser().hasRight(UserRight.SEE_ALL_COMMENTS)
}
+
+ private hasVideosRight () {
+ return this.auth.getUser().hasRight(UserRight.SEE_ALL_VIDEOS)
+ }
}