diff options
author | Chocobozzz <me@florianbigard.com> | 2018-11-21 17:05:31 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-11-21 17:05:31 +0100 |
commit | f97c91f7ec4afc26ab790fbefa63d11b3060f40f (patch) | |
tree | d7548e28e0bb645cc0bdbc4620f868303444a194 /client/src/app/shared/moderation | |
parent | 9fa0ea41aaa511bed3aa179dacc312fad6170c21 (diff) | |
download | PeerTube-f97c91f7ec4afc26ab790fbefa63d11b3060f40f.tar.gz PeerTube-f97c91f7ec4afc26ab790fbefa63d11b3060f40f.tar.zst PeerTube-f97c91f7ec4afc26ab790fbefa63d11b3060f40f.zip |
Add separators in user moderation dropdown
Diffstat (limited to 'client/src/app/shared/moderation')
-rw-r--r-- | client/src/app/shared/moderation/user-moderation-dropdown.component.ts | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts index 460750740..47967f8e5 100644 --- a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts +++ b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts | |||
@@ -26,7 +26,7 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
26 | @Output() userChanged = new EventEmitter() | 26 | @Output() userChanged = new EventEmitter() |
27 | @Output() userDeleted = new EventEmitter() | 27 | @Output() userDeleted = new EventEmitter() |
28 | 28 | ||
29 | userActions: DropdownAction<{ user: User, account: Account }>[] = [] | 29 | userActions: DropdownAction<{ user: User, account: Account }>[][] = [] |
30 | 30 | ||
31 | constructor ( | 31 | constructor ( |
32 | private authService: AuthService, | 32 | private authService: AuthService, |
@@ -264,7 +264,7 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
264 | if (this.user && authUser.id === this.user.id) return | 264 | if (this.user && authUser.id === this.user.id) return |
265 | 265 | ||
266 | if (this.user && authUser.hasRight(UserRight.MANAGE_USERS)) { | 266 | if (this.user && authUser.hasRight(UserRight.MANAGE_USERS)) { |
267 | this.userActions = this.userActions.concat([ | 267 | this.userActions.push([ |
268 | { | 268 | { |
269 | label: this.i18n('Edit'), | 269 | label: this.i18n('Edit'), |
270 | linkBuilder: ({ user }) => this.getRouterUserEditLink(user) | 270 | linkBuilder: ({ user }) => this.getRouterUserEditLink(user) |
@@ -294,7 +294,7 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
294 | // Actions on accounts/servers | 294 | // Actions on accounts/servers |
295 | if (this.account) { | 295 | if (this.account) { |
296 | // User actions | 296 | // User actions |
297 | this.userActions = this.userActions.concat([ | 297 | this.userActions.push([ |
298 | { | 298 | { |
299 | label: this.i18n('Mute this account'), | 299 | label: this.i18n('Mute this account'), |
300 | isDisplayed: ({ account }: { account: Account }) => account.mutedByUser === false, | 300 | isDisplayed: ({ account }: { account: Account }) => account.mutedByUser === false, |
@@ -317,9 +317,11 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
317 | } | 317 | } |
318 | ]) | 318 | ]) |
319 | 319 | ||
320 | let instanceActions: DropdownAction<{ user: User, account: Account }>[] = [] | ||
321 | |||
320 | // Instance actions | 322 | // Instance actions |
321 | if (authUser.hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)) { | 323 | if (authUser.hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)) { |
322 | this.userActions = this.userActions.concat([ | 324 | instanceActions = instanceActions.concat([ |
323 | { | 325 | { |
324 | label: this.i18n('Mute this account by your instance'), | 326 | label: this.i18n('Mute this account by your instance'), |
325 | isDisplayed: ({ account }: { account: Account }) => account.mutedByInstance === false, | 327 | isDisplayed: ({ account }: { account: Account }) => account.mutedByInstance === false, |
@@ -335,7 +337,7 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
335 | 337 | ||
336 | // Instance actions | 338 | // Instance actions |
337 | if (authUser.hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)) { | 339 | if (authUser.hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)) { |
338 | this.userActions = this.userActions.concat([ | 340 | instanceActions = instanceActions.concat([ |
339 | { | 341 | { |
340 | label: this.i18n('Mute the instance by your instance'), | 342 | label: this.i18n('Mute the instance by your instance'), |
341 | isDisplayed: ({ account }: { account: Account }) => !account.userId && account.mutedServerByInstance === false, | 343 | isDisplayed: ({ account }: { account: Account }) => !account.userId && account.mutedServerByInstance === false, |
@@ -348,6 +350,10 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
348 | } | 350 | } |
349 | ]) | 351 | ]) |
350 | } | 352 | } |
353 | |||
354 | if (instanceActions.length !== 0) { | ||
355 | this.userActions.push(instanceActions) | ||
356 | } | ||
351 | } | 357 | } |
352 | } | 358 | } |
353 | } | 359 | } |