diff options
Diffstat (limited to 'client/src/app/shared/moderation')
4 files changed, 254 insertions, 56 deletions
diff --git a/client/src/app/shared/moderation/user-ban-modal.component.html b/client/src/app/shared/moderation/user-ban-modal.component.html index b2958caa4..f38ea543d 100644 --- a/client/src/app/shared/moderation/user-ban-modal.component.html +++ b/client/src/app/shared/moderation/user-ban-modal.component.html | |||
@@ -1,7 +1,8 @@ | |||
1 | <ng-template #modal> | 1 | <ng-template #modal> |
2 | <div class="modal-header"> | 2 | <div class="modal-header"> |
3 | <h4 i18n class="modal-title">Ban {{ userToBan.username }}</h4> | 3 | <h4 i18n class="modal-title">Ban</h4> |
4 | <span class="close" aria-hidden="true" (click)="hideBanUserModal()"></span> | 4 | |
5 | <my-global-icon iconName="cross" aria-label="Close" role="button" (click)="hide()"></my-global-icon> | ||
5 | </div> | 6 | </div> |
6 | 7 | ||
7 | <div class="modal-body"> | 8 | <div class="modal-body"> |
@@ -19,7 +20,7 @@ | |||
19 | </div> | 20 | </div> |
20 | 21 | ||
21 | <div class="form-group inputs"> | 22 | <div class="form-group inputs"> |
22 | <span i18n class="action-button action-button-cancel" (click)="hideBanUserModal()">Cancel</span> | 23 | <span i18n class="action-button action-button-cancel" (click)="hide()">Cancel</span> |
23 | 24 | ||
24 | <input | 25 | <input |
25 | type="submit" i18n-value value="Ban this user" class="action-button-submit" | 26 | type="submit" i18n-value value="Ban this user" class="action-button-submit" |
@@ -29,4 +30,4 @@ | |||
29 | </form> | 30 | </form> |
30 | </div> | 31 | </div> |
31 | 32 | ||
32 | </ng-template> \ No newline at end of file | 33 | </ng-template> |
diff --git a/client/src/app/shared/moderation/user-ban-modal.component.ts b/client/src/app/shared/moderation/user-ban-modal.component.ts index 67ae38e48..942765301 100644 --- a/client/src/app/shared/moderation/user-ban-modal.component.ts +++ b/client/src/app/shared/moderation/user-ban-modal.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
@@ -15,15 +15,15 @@ import { User } from '../../../../../shared' | |||
15 | }) | 15 | }) |
16 | export class UserBanModalComponent extends FormReactive implements OnInit { | 16 | export class UserBanModalComponent extends FormReactive implements OnInit { |
17 | @ViewChild('modal') modal: NgbModal | 17 | @ViewChild('modal') modal: NgbModal |
18 | @Output() userBanned = new EventEmitter<User>() | 18 | @Output() userBanned = new EventEmitter<User | User[]>() |
19 | 19 | ||
20 | private userToBan: User | 20 | private usersToBan: User | User[] |
21 | private openedModal: NgbModalRef | 21 | private openedModal: NgbModalRef |
22 | 22 | ||
23 | constructor ( | 23 | constructor ( |
24 | protected formValidatorService: FormValidatorService, | 24 | protected formValidatorService: FormValidatorService, |
25 | private modalService: NgbModal, | 25 | private modalService: NgbModal, |
26 | private notificationsService: NotificationsService, | 26 | private notifier: Notifier, |
27 | private userService: UserService, | 27 | private userService: UserService, |
28 | private userValidatorsService: UserValidatorsService, | 28 | private userValidatorsService: UserValidatorsService, |
29 | private i18n: I18n | 29 | private i18n: I18n |
@@ -37,32 +37,33 @@ export class UserBanModalComponent extends FormReactive implements OnInit { | |||
37 | }) | 37 | }) |
38 | } | 38 | } |
39 | 39 | ||
40 | openModal (user: User) { | 40 | openModal (user: User | User[]) { |
41 | this.userToBan = user | 41 | this.usersToBan = user |
42 | this.openedModal = this.modalService.open(this.modal) | 42 | this.openedModal = this.modalService.open(this.modal) |
43 | } | 43 | } |
44 | 44 | ||
45 | hideBanUserModal () { | 45 | hide () { |
46 | this.userToBan = undefined | 46 | this.usersToBan = undefined |
47 | this.openedModal.close() | 47 | this.openedModal.close() |
48 | } | 48 | } |
49 | 49 | ||
50 | async banUser () { | 50 | async banUser () { |
51 | const reason = this.form.value['reason'] || undefined | 51 | const reason = this.form.value['reason'] || undefined |
52 | 52 | ||
53 | this.userService.banUser(this.userToBan, reason) | 53 | this.userService.banUsers(this.usersToBan, reason) |
54 | .subscribe( | 54 | .subscribe( |
55 | () => { | 55 | () => { |
56 | this.notificationsService.success( | 56 | const message = Array.isArray(this.usersToBan) |
57 | this.i18n('Success'), | 57 | ? this.i18n('{{num}} users banned.', { num: this.usersToBan.length }) |
58 | this.i18n('User {{username}} banned.', { username: this.userToBan.username }) | 58 | : this.i18n('User {{username}} banned.', { username: this.usersToBan.username }) |
59 | ) | ||
60 | 59 | ||
61 | this.userBanned.emit(this.userToBan) | 60 | this.notifier.success(message) |
62 | this.hideBanUserModal() | 61 | |
62 | this.userBanned.emit(this.usersToBan) | ||
63 | this.hide() | ||
63 | }, | 64 | }, |
64 | 65 | ||
65 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 66 | err => this.notifier.error(err.message) |
66 | ) | 67 | ) |
67 | } | 68 | } |
68 | 69 | ||
diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.html b/client/src/app/shared/moderation/user-moderation-dropdown.component.html index ed1a4c863..7367a7e59 100644 --- a/client/src/app/shared/moderation/user-moderation-dropdown.component.html +++ b/client/src/app/shared/moderation/user-moderation-dropdown.component.html | |||
@@ -1,5 +1,8 @@ | |||
1 | <ng-container *ngIf="user && userActions.length !== 0"> | 1 | <ng-container *ngIf="userActions.length !== 0"> |
2 | <my-user-ban-modal #userBanModal (userBanned)="onUserBanned()"></my-user-ban-modal> | 2 | <my-user-ban-modal #userBanModal (userBanned)="onUserBanned()"></my-user-ban-modal> |
3 | 3 | ||
4 | <my-action-dropdown i18n-label label="Actions" [actions]="userActions" [entry]="user" [buttonSize]="buttonSize"></my-action-dropdown> | 4 | <my-action-dropdown |
5 | [actions]="userActions" [entry]="{ user: user, account: account }" | ||
6 | [buttonSize]="buttonSize" [placement]="placement" | ||
7 | ></my-action-dropdown> | ||
5 | </ng-container> \ No newline at end of file | 8 | </ng-container> \ No newline at end of file |
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 4f88456de..9a2461ebf 100644 --- a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts +++ b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts | |||
@@ -1,50 +1,53 @@ | |||
1 | import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | ||
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | 2 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' | 3 | import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' |
5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | ||
6 | import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component' | 4 | import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component' |
7 | import { UserService } from '@app/shared/users' | 5 | import { UserService } from '@app/shared/users' |
8 | import { AuthService, ConfirmService } from '@app/core' | 6 | import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core' |
9 | import { User, UserRight } from '../../../../../shared/models/users' | 7 | import { User, UserRight } from '../../../../../shared/models/users' |
8 | import { Account } from '@app/shared/account/account.model' | ||
9 | import { BlocklistService } from '@app/shared/blocklist' | ||
10 | 10 | ||
11 | @Component({ | 11 | @Component({ |
12 | selector: 'my-user-moderation-dropdown', | 12 | selector: 'my-user-moderation-dropdown', |
13 | templateUrl: './user-moderation-dropdown.component.html', | 13 | templateUrl: './user-moderation-dropdown.component.html', |
14 | styleUrls: [ './user-moderation-dropdown.component.scss' ] | 14 | styleUrls: [ './user-moderation-dropdown.component.scss' ] |
15 | }) | 15 | }) |
16 | export class UserModerationDropdownComponent implements OnInit { | 16 | export class UserModerationDropdownComponent implements OnChanges { |
17 | @ViewChild('userBanModal') userBanModal: UserBanModalComponent | 17 | @ViewChild('userBanModal') userBanModal: UserBanModalComponent |
18 | 18 | ||
19 | @Input() user: User | 19 | @Input() user: User |
20 | @Input() account: Account | ||
21 | |||
20 | @Input() buttonSize: 'normal' | 'small' = 'normal' | 22 | @Input() buttonSize: 'normal' | 'small' = 'normal' |
23 | @Input() placement = 'left' | ||
21 | 24 | ||
22 | @Output() userChanged = new EventEmitter() | 25 | @Output() userChanged = new EventEmitter() |
23 | @Output() userDeleted = new EventEmitter() | 26 | @Output() userDeleted = new EventEmitter() |
24 | 27 | ||
25 | userActions: DropdownAction<User>[] = [] | 28 | userActions: DropdownAction<{ user: User, account: Account }>[][] = [] |
26 | |||
27 | private openedModal: NgbModalRef | ||
28 | 29 | ||
29 | constructor ( | 30 | constructor ( |
30 | private authService: AuthService, | 31 | private authService: AuthService, |
31 | private notificationsService: NotificationsService, | 32 | private notifier: Notifier, |
32 | private confirmService: ConfirmService, | 33 | private confirmService: ConfirmService, |
34 | private serverService: ServerService, | ||
33 | private userService: UserService, | 35 | private userService: UserService, |
36 | private blocklistService: BlocklistService, | ||
34 | private i18n: I18n | 37 | private i18n: I18n |
35 | ) { } | 38 | ) { } |
36 | 39 | ||
37 | ngOnInit () { | 40 | get requiresEmailVerification () { |
38 | this.buildActions() | 41 | return this.serverService.getConfig().signup.requiresEmailVerification |
39 | } | 42 | } |
40 | 43 | ||
41 | hideBanUserModal () { | 44 | ngOnChanges () { |
42 | this.openedModal.close() | 45 | this.buildActions() |
43 | } | 46 | } |
44 | 47 | ||
45 | openBanUserModal (user: User) { | 48 | openBanUserModal (user: User) { |
46 | if (user.username === 'root') { | 49 | if (user.username === 'root') { |
47 | this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot ban root.')) | 50 | this.notifier.error(this.i18n('You cannot ban root.')) |
48 | return | 51 | return |
49 | } | 52 | } |
50 | 53 | ||
@@ -60,24 +63,21 @@ export class UserModerationDropdownComponent implements OnInit { | |||
60 | const res = await this.confirmService.confirm(message, this.i18n('Unban')) | 63 | const res = await this.confirmService.confirm(message, this.i18n('Unban')) |
61 | if (res === false) return | 64 | if (res === false) return |
62 | 65 | ||
63 | this.userService.unbanUser(user) | 66 | this.userService.unbanUsers(user) |
64 | .subscribe( | 67 | .subscribe( |
65 | () => { | 68 | () => { |
66 | this.notificationsService.success( | 69 | this.notifier.success(this.i18n('User {{username}} unbanned.', { username: user.username })) |
67 | this.i18n('Success'), | ||
68 | this.i18n('User {{username}} unbanned.', { username: user.username }) | ||
69 | ) | ||
70 | 70 | ||
71 | this.userChanged.emit() | 71 | this.userChanged.emit() |
72 | }, | 72 | }, |
73 | 73 | ||
74 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 74 | err => this.notifier.error(err.message) |
75 | ) | 75 | ) |
76 | } | 76 | } |
77 | 77 | ||
78 | async removeUser (user: User) { | 78 | async removeUser (user: User) { |
79 | if (user.username === 'root') { | 79 | if (user.username === 'root') { |
80 | this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot delete root.')) | 80 | this.notifier.error(this.i18n('You cannot delete root.')) |
81 | return | 81 | return |
82 | } | 82 | } |
83 | 83 | ||
@@ -87,17 +87,138 @@ export class UserModerationDropdownComponent implements OnInit { | |||
87 | 87 | ||
88 | this.userService.removeUser(user).subscribe( | 88 | this.userService.removeUser(user).subscribe( |
89 | () => { | 89 | () => { |
90 | this.notificationsService.success( | 90 | this.notifier.success(this.i18n('User {{username}} deleted.', { username: user.username })) |
91 | this.i18n('Success'), | ||
92 | this.i18n('User {{username}} deleted.', { username: user.username }) | ||
93 | ) | ||
94 | this.userDeleted.emit() | 91 | this.userDeleted.emit() |
95 | }, | 92 | }, |
96 | 93 | ||
97 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 94 | err => this.notifier.error(err.message) |
98 | ) | 95 | ) |
99 | } | 96 | } |
100 | 97 | ||
98 | setEmailAsVerified (user: User) { | ||
99 | this.userService.updateUser(user.id, { emailVerified: true }).subscribe( | ||
100 | () => { | ||
101 | this.notifier.success(this.i18n('User {{username}} email set as verified', { username: user.username })) | ||
102 | |||
103 | this.userChanged.emit() | ||
104 | }, | ||
105 | |||
106 | err => this.notifier.error(err.message) | ||
107 | ) | ||
108 | } | ||
109 | |||
110 | blockAccountByUser (account: Account) { | ||
111 | this.blocklistService.blockAccountByUser(account) | ||
112 | .subscribe( | ||
113 | () => { | ||
114 | this.notifier.success(this.i18n('Account {{nameWithHost}} muted.', { nameWithHost: account.nameWithHost })) | ||
115 | |||
116 | this.account.mutedByUser = true | ||
117 | this.userChanged.emit() | ||
118 | }, | ||
119 | |||
120 | err => this.notifier.error(err.message) | ||
121 | ) | ||
122 | } | ||
123 | |||
124 | unblockAccountByUser (account: Account) { | ||
125 | this.blocklistService.unblockAccountByUser(account) | ||
126 | .subscribe( | ||
127 | () => { | ||
128 | this.notifier.success(this.i18n('Account {{nameWithHost}} unmuted.', { nameWithHost: account.nameWithHost })) | ||
129 | |||
130 | this.account.mutedByUser = false | ||
131 | this.userChanged.emit() | ||
132 | }, | ||
133 | |||
134 | err => this.notifier.error(err.message) | ||
135 | ) | ||
136 | } | ||
137 | |||
138 | blockServerByUser (host: string) { | ||
139 | this.blocklistService.blockServerByUser(host) | ||
140 | .subscribe( | ||
141 | () => { | ||
142 | this.notifier.success(this.i18n('Instance {{host}} muted.', { host })) | ||
143 | |||
144 | this.account.mutedServerByUser = true | ||
145 | this.userChanged.emit() | ||
146 | }, | ||
147 | |||
148 | err => this.notifier.error(err.message) | ||
149 | ) | ||
150 | } | ||
151 | |||
152 | unblockServerByUser (host: string) { | ||
153 | this.blocklistService.unblockServerByUser(host) | ||
154 | .subscribe( | ||
155 | () => { | ||
156 | this.notifier.success(this.i18n('Instance {{host}} unmuted.', { host })) | ||
157 | |||
158 | this.account.mutedServerByUser = false | ||
159 | this.userChanged.emit() | ||
160 | }, | ||
161 | |||
162 | err => this.notifier.error(err.message) | ||
163 | ) | ||
164 | } | ||
165 | |||
166 | blockAccountByInstance (account: Account) { | ||
167 | this.blocklistService.blockAccountByInstance(account) | ||
168 | .subscribe( | ||
169 | () => { | ||
170 | this.notifier.success(this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost })) | ||
171 | |||
172 | this.account.mutedByInstance = true | ||
173 | this.userChanged.emit() | ||
174 | }, | ||
175 | |||
176 | err => this.notifier.error(err.message) | ||
177 | ) | ||
178 | } | ||
179 | |||
180 | unblockAccountByInstance (account: Account) { | ||
181 | this.blocklistService.unblockAccountByInstance(account) | ||
182 | .subscribe( | ||
183 | () => { | ||
184 | this.notifier.success(this.i18n('Account {{nameWithHost}} unmuted by the instance.', { nameWithHost: account.nameWithHost })) | ||
185 | |||
186 | this.account.mutedByInstance = false | ||
187 | this.userChanged.emit() | ||
188 | }, | ||
189 | |||
190 | err => this.notifier.error(err.message) | ||
191 | ) | ||
192 | } | ||
193 | |||
194 | blockServerByInstance (host: string) { | ||
195 | this.blocklistService.blockServerByInstance(host) | ||
196 | .subscribe( | ||
197 | () => { | ||
198 | this.notifier.success(this.i18n('Instance {{host}} muted by the instance.', { host })) | ||
199 | |||
200 | this.account.mutedServerByInstance = true | ||
201 | this.userChanged.emit() | ||
202 | }, | ||
203 | |||
204 | err => this.notifier.error(err.message) | ||
205 | ) | ||
206 | } | ||
207 | |||
208 | unblockServerByInstance (host: string) { | ||
209 | this.blocklistService.unblockServerByInstance(host) | ||
210 | .subscribe( | ||
211 | () => { | ||
212 | this.notifier.success(this.i18n('Instance {{host}} unmuted by the instance.', { host })) | ||
213 | |||
214 | this.account.mutedServerByInstance = false | ||
215 | this.userChanged.emit() | ||
216 | }, | ||
217 | |||
218 | err => this.notifier.error(err.message) | ||
219 | ) | ||
220 | } | ||
221 | |||
101 | getRouterUserEditLink (user: User) { | 222 | getRouterUserEditLink (user: User) { |
102 | return [ '/admin', 'users', 'update', user.id ] | 223 | return [ '/admin', 'users', 'update', user.id ] |
103 | } | 224 | } |
@@ -108,28 +229,100 @@ export class UserModerationDropdownComponent implements OnInit { | |||
108 | if (this.authService.isLoggedIn()) { | 229 | if (this.authService.isLoggedIn()) { |
109 | const authUser = this.authService.getUser() | 230 | const authUser = this.authService.getUser() |
110 | 231 | ||
111 | if (authUser.hasRight(UserRight.MANAGE_USERS)) { | 232 | if (this.user && authUser.id === this.user.id) return |
112 | this.userActions = this.userActions.concat([ | 233 | |
234 | if (this.user && authUser.hasRight(UserRight.MANAGE_USERS)) { | ||
235 | this.userActions.push([ | ||
113 | { | 236 | { |
114 | label: this.i18n('Edit'), | 237 | label: this.i18n('Edit'), |
115 | linkBuilder: this.getRouterUserEditLink | 238 | linkBuilder: ({ user }) => this.getRouterUserEditLink(user) |
116 | }, | 239 | }, |
117 | { | 240 | { |
118 | label: this.i18n('Delete'), | 241 | label: this.i18n('Delete'), |
119 | handler: user => this.removeUser(user) | 242 | handler: ({ user }) => this.removeUser(user) |
120 | }, | 243 | }, |
121 | { | 244 | { |
122 | label: this.i18n('Ban'), | 245 | label: this.i18n('Ban'), |
123 | handler: user => this.openBanUserModal(user), | 246 | handler: ({ user }) => this.openBanUserModal(user), |
124 | isDisplayed: user => !user.blocked | 247 | isDisplayed: ({ user }) => !user.blocked |
125 | }, | 248 | }, |
126 | { | 249 | { |
127 | label: this.i18n('Unban'), | 250 | label: this.i18n('Unban'), |
128 | handler: user => this.unbanUser(user), | 251 | handler: ({ user }) => this.unbanUser(user), |
129 | isDisplayed: user => user.blocked | 252 | isDisplayed: ({ user }) => user.blocked |
253 | }, | ||
254 | { | ||
255 | label: this.i18n('Set Email as Verified'), | ||
256 | handler: ({ user }) => this.setEmailAsVerified(user), | ||
257 | isDisplayed: ({ user }) => this.requiresEmailVerification && !user.blocked && user.emailVerified === false | ||
130 | } | 258 | } |
131 | ]) | 259 | ]) |
132 | } | 260 | } |
261 | |||
262 | // Actions on accounts/servers | ||
263 | if (this.account) { | ||
264 | // User actions | ||
265 | this.userActions.push([ | ||
266 | { | ||
267 | label: this.i18n('Mute this account'), | ||
268 | isDisplayed: ({ account }) => account.mutedByUser === false, | ||
269 | handler: ({ account }) => this.blockAccountByUser(account) | ||
270 | }, | ||
271 | { | ||
272 | label: this.i18n('Unmute this account'), | ||
273 | isDisplayed: ({ account }) => account.mutedByUser === true, | ||
274 | handler: ({ account }) => this.unblockAccountByUser(account) | ||
275 | }, | ||
276 | { | ||
277 | label: this.i18n('Mute the instance'), | ||
278 | isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === false, | ||
279 | handler: ({ account }) => this.blockServerByUser(account.host) | ||
280 | }, | ||
281 | { | ||
282 | label: this.i18n('Unmute the instance'), | ||
283 | isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === true, | ||
284 | handler: ({ account }) => this.unblockServerByUser(account.host) | ||
285 | } | ||
286 | ]) | ||
287 | |||
288 | let instanceActions: DropdownAction<{ user: User, account: Account }>[] = [] | ||
289 | |||
290 | // Instance actions | ||
291 | if (authUser.hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)) { | ||
292 | instanceActions = instanceActions.concat([ | ||
293 | { | ||
294 | label: this.i18n('Mute this account by your instance'), | ||
295 | isDisplayed: ({ account }) => account.mutedByInstance === false, | ||
296 | handler: ({ account }) => this.blockAccountByInstance(account) | ||
297 | }, | ||
298 | { | ||
299 | label: this.i18n('Unmute this account by your instance'), | ||
300 | isDisplayed: ({ account }) => account.mutedByInstance === true, | ||
301 | handler: ({ account }) => this.unblockAccountByInstance(account) | ||
302 | } | ||
303 | ]) | ||
304 | } | ||
305 | |||
306 | // Instance actions | ||
307 | if (authUser.hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)) { | ||
308 | instanceActions = instanceActions.concat([ | ||
309 | { | ||
310 | label: this.i18n('Mute the instance by your instance'), | ||
311 | isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === false, | ||
312 | handler: ({ account }) => this.blockServerByInstance(account.host) | ||
313 | }, | ||
314 | { | ||
315 | label: this.i18n('Unmute the instance by your instance'), | ||
316 | isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === true, | ||
317 | handler: ({ account }) => this.unblockServerByInstance(account.host) | ||
318 | } | ||
319 | ]) | ||
320 | } | ||
321 | |||
322 | if (instanceActions.length !== 0) { | ||
323 | this.userActions.push(instanceActions) | ||
324 | } | ||
325 | } | ||
133 | } | 326 | } |
134 | } | 327 | } |
135 | } | 328 | } |