aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/admin.component.html8
-rw-r--r--client/src/app/+admin/admin.component.scss3
-rw-r--r--client/src/app/+admin/admin.component.ts71
-rw-r--r--client/src/app/+admin/follows/follows.component.html12
-rw-r--r--client/src/app/+admin/moderation/moderation.component.html14
-rw-r--r--client/src/app/+admin/moderation/moderation.component.ts21
6 files changed, 69 insertions, 60 deletions
diff --git a/client/src/app/+admin/admin.component.html b/client/src/app/+admin/admin.component.html
index 76d297c52..3999252be 100644
--- a/client/src/app/+admin/admin.component.html
+++ b/client/src/app/+admin/admin.component.html
@@ -1,11 +1,5 @@
1<div class="row"> 1<div class="row">
2 <div class="sub-menu"> 2 <my-top-menu-dropdown [menuEntries]="menuEntries"></my-top-menu-dropdown>
3 <ng-template #linkTemplate let-item="item">
4 <a [routerLink]="item.routerLink" routerLinkActive="active" class="title-page title-page-settings">{{ item.label }}</a>
5 </ng-template>
6
7 <list-overflow [items]="items" [itemTemplate]="linkTemplate"></list-overflow>
8 </div>
9 3
10 <div class="margin-content"> 4 <div class="margin-content">
11 <router-outlet></router-outlet> 5 <router-outlet></router-outlet>
diff --git a/client/src/app/+admin/admin.component.scss b/client/src/app/+admin/admin.component.scss
new file mode 100644
index 000000000..ef8965c3f
--- /dev/null
+++ b/client/src/app/+admin/admin.component.scss
@@ -0,0 +1,3 @@
1my-top-menu-dropdown {
2 flex-grow: 1;
3}
diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.ts
index e47c7a8f4..c1c160ad1 100644
--- a/client/src/app/+admin/admin.component.ts
+++ b/client/src/app/+admin/admin.component.ts
@@ -3,12 +3,15 @@ import { AuthService } from '@app/core'
3import { ListOverflowItem } from '@app/shared/shared-main' 3import { ListOverflowItem } from '@app/shared/shared-main'
4import { I18n } from '@ngx-translate/i18n-polyfill' 4import { I18n } from '@ngx-translate/i18n-polyfill'
5import { UserRight } from '@shared/models' 5import { UserRight } from '@shared/models'
6import { TopMenuDropdownParam } from '@app/shared/shared-main/misc/top-menu-dropdown.component'
6 7
7@Component({ 8@Component({
8 templateUrl: './admin.component.html' 9 templateUrl: './admin.component.html',
10 styleUrls: [ './admin.component.scss' ]
9}) 11})
10export class AdminComponent implements OnInit { 12export class AdminComponent implements OnInit {
11 items: ListOverflowItem[] = [] 13 items: ListOverflowItem[] = []
14 menuEntries: TopMenuDropdownParam[] = []
12 15
13 constructor ( 16 constructor (
14 private auth: AuthService, 17 private auth: AuthService,
@@ -16,12 +19,58 @@ export class AdminComponent implements OnInit {
16 ) {} 19 ) {}
17 20
18 ngOnInit () { 21 ngOnInit () {
19 if (this.hasUsersRight()) this.items.push({ label: this.i18n('Users'), routerLink: '/admin/users' }) 22 const federationItems: TopMenuDropdownParam = {
20 if (this.hasServerFollowRight()) this.items.push({ label: this.i18n('Follows & redundancies'), routerLink: '/admin/follows' }) 23 label: this.i18n('Federation'),
21 if (this.hasVideoAbusesRight() || this.hasVideoBlocklistRight()) this.items.push({ label: this.i18n('Moderation'), routerLink: '/admin/moderation' }) 24 children: [
22 if (this.hasConfigRight()) this.items.push({ label: this.i18n('Configuration'), routerLink: '/admin/config' }) 25 {
23 if (this.hasPluginsRight()) this.items.push({ label: this.i18n('Plugins/Themes'), routerLink: '/admin/plugins' }) 26 label: this.i18n('Instances you follow'),
24 if (this.hasJobsRight() || this.hasLogsRight() || this.hasDebugRight()) this.items.push({ label: this.i18n('System'), routerLink: '/admin/system' }) 27 routerLink: '/admin/follows/following-list',
28 iconName: 'sign-out'
29 },
30 {
31 label: this.i18n('Instances following you'),
32 routerLink: '/admin/follows/followers-list',
33 iconName: 'sign-in'
34 },
35 {
36 label: this.i18n('Video redundancies'),
37 routerLink: '/admin/follows/video-redundancies-list',
38 iconName: 'videos'
39 }
40 ]
41 }
42
43 const moderationItems: TopMenuDropdownParam = {
44 label: this.i18n('Moderation'),
45 children: []
46 }
47 if (this.hasVideoAbusesRight()) moderationItems.children.push({
48 label: this.i18n('Video reports'),
49 routerLink: '/admin/moderation/video-abuses/list',
50 iconName: 'flag'
51 })
52 if (this.hasVideoBlocklistRight()) moderationItems.children.push({
53 label: this.i18n('Video blocks'),
54 routerLink: '/admin/moderation/video-blocks/list',
55 iconName: 'cross'
56 })
57 if (this.hasAccountsBlocklistRight()) moderationItems.children.push({
58 label: this.i18n('Muted accounts'),
59 routerLink: '/admin/moderation/blocklist/accounts',
60 iconName: 'user'
61 })
62 if (this.hasServersBlocklistRight()) moderationItems.children.push({
63 label: this.i18n('Muted servers'),
64 routerLink: '/admin/moderation/blocklist/servers',
65 iconName: 'server'
66 })
67
68 if (this.hasUsersRight()) this.menuEntries.push({ label: this.i18n('Users'), routerLink: '/admin/users' })
69 if (this.hasServerFollowRight()) this.menuEntries.push(federationItems)
70 if (this.hasVideoAbusesRight() || this.hasVideoBlocklistRight()) this.menuEntries.push(moderationItems)
71 if (this.hasConfigRight()) this.menuEntries.push({ label: this.i18n('Configuration'), routerLink: '/admin/config' })
72 if (this.hasPluginsRight()) this.menuEntries.push({ label: this.i18n('Plugins/Themes'), routerLink: '/admin/plugins' })
73 if (this.hasJobsRight() || this.hasLogsRight() || this.hasDebugRight()) this.menuEntries.push({ label: this.i18n('System'), routerLink: '/admin/system' })
25 } 74 }
26 75
27 hasUsersRight () { 76 hasUsersRight () {
@@ -40,6 +89,14 @@ export class AdminComponent implements OnInit {
40 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) 89 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
41 } 90 }
42 91
92 hasAccountsBlocklistRight () {
93 return this.auth.getUser().hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)
94 }
95
96 hasServersBlocklistRight () {
97 return this.auth.getUser().hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)
98 }
99
43 hasConfigRight () { 100 hasConfigRight () {
44 return this.auth.getUser().hasRight(UserRight.MANAGE_CONFIGURATION) 101 return this.auth.getUser().hasRight(UserRight.MANAGE_CONFIGURATION)
45 } 102 }
diff --git a/client/src/app/+admin/follows/follows.component.html b/client/src/app/+admin/follows/follows.component.html
index 8c3129394..0680b43f9 100644
--- a/client/src/app/+admin/follows/follows.component.html
+++ b/client/src/app/+admin/follows/follows.component.html
@@ -1,13 +1 @@
1<div class="admin-sub-header">
2 <h1 i18n class="form-sub-title">Follows & redundancies</h1>
3
4 <div class="admin-sub-nav">
5 <a i18n routerLink="following-list" routerLinkActive="active">Following</a>
6
7 <a i18n routerLink="followers-list" routerLinkActive="active">Followers</a>
8
9 <a i18n routerLink="video-redundancies-list" routerLinkActive="active">Video redundancies</a>
10 </div>
11</div>
12
13<router-outlet></router-outlet> <router-outlet></router-outlet>
diff --git a/client/src/app/+admin/moderation/moderation.component.html b/client/src/app/+admin/moderation/moderation.component.html
index 7bab63c33..90c6b6463 100644
--- a/client/src/app/+admin/moderation/moderation.component.html
+++ b/client/src/app/+admin/moderation/moderation.component.html
@@ -1,15 +1 @@
1<div class="admin-sub-header">
2 <h1 i18n class="form-sub-title">Moderation</h1>
3
4 <div class="admin-sub-nav">
5 <a *ngIf="hasVideoAbusesRight()" i18n routerLink="video-abuses/list" routerLinkActive="active">Video reports</a>
6
7 <a *ngIf="hasVideoBlocklistRight()" i18n routerLink="video-blocks/list" routerLinkActive="active">Video blocks</a>
8
9 <a *ngIf="hasAccountsBlocklistRight()" i18n routerLink="blocklist/accounts" routerLinkActive="active">Muted accounts</a>
10
11 <a *ngIf="hasServersBlocklistRight()" i18n routerLink="blocklist/servers" routerLinkActive="active">Muted servers</a>
12 </div>
13</div>
14
15<router-outlet></router-outlet> \ No newline at end of file <router-outlet></router-outlet> \ No newline at end of file
diff --git a/client/src/app/+admin/moderation/moderation.component.ts b/client/src/app/+admin/moderation/moderation.component.ts
index 806f9d100..b0f5eb224 100644
--- a/client/src/app/+admin/moderation/moderation.component.ts
+++ b/client/src/app/+admin/moderation/moderation.component.ts
@@ -1,6 +1,5 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { AuthService, ServerService } from '@app/core' 2import { ServerService } from '@app/core'
3import { UserRight } from '@shared/models'
4 3
5@Component({ 4@Component({
6 templateUrl: './moderation.component.html', 5 templateUrl: './moderation.component.html',
@@ -10,29 +9,11 @@ export class ModerationComponent implements OnInit {
10 autoBlockVideosEnabled = false 9 autoBlockVideosEnabled = false
11 10
12 constructor ( 11 constructor (
13 private auth: AuthService,
14 private serverService: ServerService 12 private serverService: ServerService
15 ) { } 13 ) { }
16 14
17 ngOnInit (): void { 15 ngOnInit (): void {
18 this.serverService.getConfig() 16 this.serverService.getConfig()
19 .subscribe(config => this.autoBlockVideosEnabled = config.autoBlacklist.videos.ofUsers.enabled) 17 .subscribe(config => this.autoBlockVideosEnabled = config.autoBlacklist.videos.ofUsers.enabled)
20
21 }
22
23 hasVideoAbusesRight () {
24 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_ABUSES)
25 }
26
27 hasVideoBlocklistRight () {
28 return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
29 }
30
31 hasAccountsBlocklistRight () {
32 return this.auth.getUser().hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)
33 }
34
35 hasServersBlocklistRight () {
36 return this.auth.getUser().hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)
37 } 18 }
38} 19}