aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/forms/reactive-file.component.ts6
-rw-r--r--client/src/app/shared/moderation/user-ban-modal.component.ts8
-rw-r--r--client/src/app/shared/moderation/user-moderation-dropdown.component.ts86
-rw-r--r--client/src/app/shared/user-subscription/subscribe-button.component.ts23
-rw-r--r--client/src/app/shared/video/abstract-video-list.ts6
5 files changed, 47 insertions, 82 deletions
diff --git a/client/src/app/shared/forms/reactive-file.component.ts b/client/src/app/shared/forms/reactive-file.component.ts
index 8d22aa56c..c3986838f 100644
--- a/client/src/app/shared/forms/reactive-file.component.ts
+++ b/client/src/app/shared/forms/reactive-file.component.ts
@@ -1,6 +1,6 @@
1import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core' 1import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core'
2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' 2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
3import { NotificationsService } from 'angular2-notifications' 3import { Notifier } from '@app/core'
4import { I18n } from '@ngx-translate/i18n-polyfill' 4import { I18n } from '@ngx-translate/i18n-polyfill'
5 5
6@Component({ 6@Component({
@@ -30,7 +30,7 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor {
30 private file: File 30 private file: File
31 31
32 constructor ( 32 constructor (
33 private notificationsService: NotificationsService, 33 private notifier: Notifier,
34 private i18n: I18n 34 private i18n: I18n
35 ) {} 35 ) {}
36 36
@@ -49,7 +49,7 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor {
49 const [ file ] = event.target.files 49 const [ file ] = event.target.files
50 50
51 if (file.size > this.maxFileSize) { 51 if (file.size > this.maxFileSize) {
52 this.notificationsService.error(this.i18n('Error'), this.i18n('This file is too large.')) 52 this.notifier.error(this.i18n('This file is too large.'))
53 return 53 return
54 } 54 }
55 55
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 60bd442dd..f755ba0e8 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 @@
1import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'
2import { NotificationsService } from 'angular2-notifications' 2import { Notifier } from '@app/core'
3import { I18n } from '@ngx-translate/i18n-polyfill' 3import { I18n } from '@ngx-translate/i18n-polyfill'
4import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 4import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
5import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' 5import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
@@ -23,7 +23,7 @@ export class UserBanModalComponent extends FormReactive implements OnInit {
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
@@ -57,13 +57,13 @@ export class UserBanModalComponent extends FormReactive implements OnInit {
57 ? this.i18n('{{num}} users banned.', { num: this.usersToBan.length }) 57 ? this.i18n('{{num}} users banned.', { num: this.usersToBan.length })
58 : this.i18n('User {{username}} banned.', { username: this.usersToBan.username }) 58 : this.i18n('User {{username}} banned.', { username: this.usersToBan.username })
59 59
60 this.notificationsService.success(this.i18n('Success'), message) 60 this.notifier.success(message)
61 61
62 this.userBanned.emit(this.usersToBan) 62 this.userBanned.emit(this.usersToBan)
63 this.hideBanUserModal() 63 this.hideBanUserModal()
64 }, 64 },
65 65
66 err => this.notificationsService.error(this.i18n('Error'), err.message) 66 err => this.notifier.error(err.message)
67 ) 67 )
68 } 68 }
69 69
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 e3c9db923..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,10 +1,9 @@
1import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' 1import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core'
2import { NotificationsService } from 'angular2-notifications'
3import { I18n } from '@ngx-translate/i18n-polyfill' 2import { I18n } from '@ngx-translate/i18n-polyfill'
4import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' 3import { DropdownAction } from '@app/shared/buttons/action-dropdown.component'
5import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component' 4import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component'
6import { UserService } from '@app/shared/users' 5import { UserService } from '@app/shared/users'
7import { AuthService, ConfirmService, ServerService } from '@app/core' 6import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
8import { User, UserRight } from '../../../../../shared/models/users' 7import { User, UserRight } from '../../../../../shared/models/users'
9import { Account } from '@app/shared/account/account.model' 8import { Account } from '@app/shared/account/account.model'
10import { BlocklistService } from '@app/shared/blocklist' 9import { BlocklistService } from '@app/shared/blocklist'
@@ -30,7 +29,7 @@ export class UserModerationDropdownComponent implements OnChanges {
30 29
31 constructor ( 30 constructor (
32 private authService: AuthService, 31 private authService: AuthService,
33 private notificationsService: NotificationsService, 32 private notifier: Notifier,
34 private confirmService: ConfirmService, 33 private confirmService: ConfirmService,
35 private serverService: ServerService, 34 private serverService: ServerService,
36 private userService: UserService, 35 private userService: UserService,
@@ -48,7 +47,7 @@ export class UserModerationDropdownComponent implements OnChanges {
48 47
49 openBanUserModal (user: User) { 48 openBanUserModal (user: User) {
50 if (user.username === 'root') { 49 if (user.username === 'root') {
51 this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot ban root.')) 50 this.notifier.error(this.i18n('You cannot ban root.'))
52 return 51 return
53 } 52 }
54 53
@@ -67,21 +66,18 @@ export class UserModerationDropdownComponent implements OnChanges {
67 this.userService.unbanUsers(user) 66 this.userService.unbanUsers(user)
68 .subscribe( 67 .subscribe(
69 () => { 68 () => {
70 this.notificationsService.success( 69 this.notifier.success(this.i18n('User {{username}} unbanned.', { username: user.username }))
71 this.i18n('Success'),
72 this.i18n('User {{username}} unbanned.', { username: user.username })
73 )
74 70
75 this.userChanged.emit() 71 this.userChanged.emit()
76 }, 72 },
77 73
78 err => this.notificationsService.error(this.i18n('Error'), err.message) 74 err => this.notifier.error(err.message)
79 ) 75 )
80 } 76 }
81 77
82 async removeUser (user: User) { 78 async removeUser (user: User) {
83 if (user.username === 'root') { 79 if (user.username === 'root') {
84 this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot delete root.')) 80 this.notifier.error(this.i18n('You cannot delete root.'))
85 return 81 return
86 } 82 }
87 83
@@ -91,29 +87,23 @@ export class UserModerationDropdownComponent implements OnChanges {
91 87
92 this.userService.removeUser(user).subscribe( 88 this.userService.removeUser(user).subscribe(
93 () => { 89 () => {
94 this.notificationsService.success( 90 this.notifier.success(this.i18n('User {{username}} deleted.', { username: user.username }))
95 this.i18n('Success'),
96 this.i18n('User {{username}} deleted.', { username: user.username })
97 )
98 this.userDeleted.emit() 91 this.userDeleted.emit()
99 }, 92 },
100 93
101 err => this.notificationsService.error(this.i18n('Error'), err.message) 94 err => this.notifier.error(err.message)
102 ) 95 )
103 } 96 }
104 97
105 setEmailAsVerified (user: User) { 98 setEmailAsVerified (user: User) {
106 this.userService.updateUser(user.id, { emailVerified: true }).subscribe( 99 this.userService.updateUser(user.id, { emailVerified: true }).subscribe(
107 () => { 100 () => {
108 this.notificationsService.success( 101 this.notifier.success(this.i18n('User {{username}} email set as verified', { username: user.username }))
109 this.i18n('Success'),
110 this.i18n('User {{username}} email set as verified', { username: user.username })
111 )
112 102
113 this.userChanged.emit() 103 this.userChanged.emit()
114 }, 104 },
115 105
116 err => this.notificationsService.error(this.i18n('Error'), err.message) 106 err => this.notifier.error(err.message)
117 ) 107 )
118 } 108 }
119 109
@@ -121,16 +111,13 @@ export class UserModerationDropdownComponent implements OnChanges {
121 this.blocklistService.blockAccountByUser(account) 111 this.blocklistService.blockAccountByUser(account)
122 .subscribe( 112 .subscribe(
123 () => { 113 () => {
124 this.notificationsService.success( 114 this.notifier.success(this.i18n('Account {{nameWithHost}} muted.', { nameWithHost: account.nameWithHost }))
125 this.i18n('Success'),
126 this.i18n('Account {{nameWithHost}} muted.', { nameWithHost: account.nameWithHost })
127 )
128 115
129 this.account.mutedByUser = true 116 this.account.mutedByUser = true
130 this.userChanged.emit() 117 this.userChanged.emit()
131 }, 118 },
132 119
133 err => this.notificationsService.error(this.i18n('Error'), err.message) 120 err => this.notifier.error(err.message)
134 ) 121 )
135 } 122 }
136 123
@@ -138,16 +125,13 @@ export class UserModerationDropdownComponent implements OnChanges {
138 this.blocklistService.unblockAccountByUser(account) 125 this.blocklistService.unblockAccountByUser(account)
139 .subscribe( 126 .subscribe(
140 () => { 127 () => {
141 this.notificationsService.success( 128 this.notifier.success(this.i18n('Account {{nameWithHost}} unmuted.', { nameWithHost: account.nameWithHost }))
142 this.i18n('Success'),
143 this.i18n('Account {{nameWithHost}} unmuted.', { nameWithHost: account.nameWithHost })
144 )
145 129
146 this.account.mutedByUser = false 130 this.account.mutedByUser = false
147 this.userChanged.emit() 131 this.userChanged.emit()
148 }, 132 },
149 133
150 err => this.notificationsService.error(this.i18n('Error'), err.message) 134 err => this.notifier.error(err.message)
151 ) 135 )
152 } 136 }
153 137
@@ -155,16 +139,13 @@ export class UserModerationDropdownComponent implements OnChanges {
155 this.blocklistService.blockServerByUser(host) 139 this.blocklistService.blockServerByUser(host)
156 .subscribe( 140 .subscribe(
157 () => { 141 () => {
158 this.notificationsService.success( 142 this.notifier.success(this.i18n('Instance {{host}} muted.', { host }))
159 this.i18n('Success'),
160 this.i18n('Instance {{host}} muted.', { host })
161 )
162 143
163 this.account.mutedServerByUser = true 144 this.account.mutedServerByUser = true
164 this.userChanged.emit() 145 this.userChanged.emit()
165 }, 146 },
166 147
167 err => this.notificationsService.error(this.i18n('Error'), err.message) 148 err => this.notifier.error(err.message)
168 ) 149 )
169 } 150 }
170 151
@@ -172,16 +153,13 @@ export class UserModerationDropdownComponent implements OnChanges {
172 this.blocklistService.unblockServerByUser(host) 153 this.blocklistService.unblockServerByUser(host)
173 .subscribe( 154 .subscribe(
174 () => { 155 () => {
175 this.notificationsService.success( 156 this.notifier.success(this.i18n('Instance {{host}} unmuted.', { host }))
176 this.i18n('Success'),
177 this.i18n('Instance {{host}} unmuted.', { host })
178 )
179 157
180 this.account.mutedServerByUser = false 158 this.account.mutedServerByUser = false
181 this.userChanged.emit() 159 this.userChanged.emit()
182 }, 160 },
183 161
184 err => this.notificationsService.error(this.i18n('Error'), err.message) 162 err => this.notifier.error(err.message)
185 ) 163 )
186 } 164 }
187 165
@@ -189,16 +167,13 @@ export class UserModerationDropdownComponent implements OnChanges {
189 this.blocklistService.blockAccountByInstance(account) 167 this.blocklistService.blockAccountByInstance(account)
190 .subscribe( 168 .subscribe(
191 () => { 169 () => {
192 this.notificationsService.success( 170 this.notifier.success(this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost }))
193 this.i18n('Success'),
194 this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost })
195 )
196 171
197 this.account.mutedByInstance = true 172 this.account.mutedByInstance = true
198 this.userChanged.emit() 173 this.userChanged.emit()
199 }, 174 },
200 175
201 err => this.notificationsService.error(this.i18n('Error'), err.message) 176 err => this.notifier.error(err.message)
202 ) 177 )
203 } 178 }
204 179
@@ -206,16 +181,13 @@ export class UserModerationDropdownComponent implements OnChanges {
206 this.blocklistService.unblockAccountByInstance(account) 181 this.blocklistService.unblockAccountByInstance(account)
207 .subscribe( 182 .subscribe(
208 () => { 183 () => {
209 this.notificationsService.success( 184 this.notifier.success(this.i18n('Account {{nameWithHost}} unmuted by the instance.', { nameWithHost: account.nameWithHost }))
210 this.i18n('Success'),
211 this.i18n('Account {{nameWithHost}} unmuted by the instance.', { nameWithHost: account.nameWithHost })
212 )
213 185
214 this.account.mutedByInstance = false 186 this.account.mutedByInstance = false
215 this.userChanged.emit() 187 this.userChanged.emit()
216 }, 188 },
217 189
218 err => this.notificationsService.error(this.i18n('Error'), err.message) 190 err => this.notifier.error(err.message)
219 ) 191 )
220 } 192 }
221 193
@@ -223,16 +195,13 @@ export class UserModerationDropdownComponent implements OnChanges {
223 this.blocklistService.blockServerByInstance(host) 195 this.blocklistService.blockServerByInstance(host)
224 .subscribe( 196 .subscribe(
225 () => { 197 () => {
226 this.notificationsService.success( 198 this.notifier.success(this.i18n('Instance {{host}} muted by the instance.', { host }))
227 this.i18n('Success'),
228 this.i18n('Instance {{host}} muted by the instance.', { host })
229 )
230 199
231 this.account.mutedServerByInstance = true 200 this.account.mutedServerByInstance = true
232 this.userChanged.emit() 201 this.userChanged.emit()
233 }, 202 },
234 203
235 err => this.notificationsService.error(this.i18n('Error'), err.message) 204 err => this.notifier.error(err.message)
236 ) 205 )
237 } 206 }
238 207
@@ -240,16 +209,13 @@ export class UserModerationDropdownComponent implements OnChanges {
240 this.blocklistService.unblockServerByInstance(host) 209 this.blocklistService.unblockServerByInstance(host)
241 .subscribe( 210 .subscribe(
242 () => { 211 () => {
243 this.notificationsService.success( 212 this.notifier.success(this.i18n('Instance {{host}} unmuted by the instance.', { host }))
244 this.i18n('Success'),
245 this.i18n('Instance {{host}} unmuted by the instance.', { host })
246 )
247 213
248 this.account.mutedServerByInstance = false 214 this.account.mutedServerByInstance = false
249 this.userChanged.emit() 215 this.userChanged.emit()
250 }, 216 },
251 217
252 err => this.notificationsService.error(this.i18n('Error'), err.message) 218 err => this.notifier.error(err.message)
253 ) 219 )
254 } 220 }
255 221
diff --git a/client/src/app/shared/user-subscription/subscribe-button.component.ts b/client/src/app/shared/user-subscription/subscribe-button.component.ts
index 9c8a15023..8f1754c7f 100644
--- a/client/src/app/shared/user-subscription/subscribe-button.component.ts
+++ b/client/src/app/shared/user-subscription/subscribe-button.component.ts
@@ -1,9 +1,8 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { Router } from '@angular/router' 2import { Router } from '@angular/router'
3import { AuthService } from '@app/core' 3import { AuthService, Notifier } from '@app/core'
4import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service' 4import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service'
5import { VideoChannel } from '@app/shared/video-channel/video-channel.model' 5import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
6import { NotificationsService } from 'angular2-notifications'
7import { I18n } from '@ngx-translate/i18n-polyfill' 6import { I18n } from '@ngx-translate/i18n-polyfill'
8import { VideoService } from '@app/shared/video/video.service' 7import { VideoService } from '@app/shared/video/video.service'
9import { FeedFormat } from '../../../../../shared/models/feeds' 8import { FeedFormat } from '../../../../../shared/models/feeds'
@@ -23,7 +22,7 @@ export class SubscribeButtonComponent implements OnInit {
23 constructor ( 22 constructor (
24 private authService: AuthService, 23 private authService: AuthService,
25 private router: Router, 24 private router: Router,
26 private notificationsService: NotificationsService, 25 private notifier: Notifier,
27 private userSubscriptionService: UserSubscriptionService, 26 private userSubscriptionService: UserSubscriptionService,
28 private i18n: I18n, 27 private i18n: I18n,
29 private videoService: VideoService 28 private videoService: VideoService
@@ -43,7 +42,7 @@ export class SubscribeButtonComponent implements OnInit {
43 .subscribe( 42 .subscribe(
44 res => this.subscribed = res[this.uri], 43 res => this.subscribed = res[this.uri],
45 44
46 err => this.notificationsService.error(this.i18n('Error'), err.message) 45 err => this.notifier.error(err.message)
47 ) 46 )
48 } 47 }
49 } 48 }
@@ -62,13 +61,13 @@ export class SubscribeButtonComponent implements OnInit {
62 () => { 61 () => {
63 this.subscribed = true 62 this.subscribed = true
64 63
65 this.notificationsService.success( 64 this.notifier.success(
66 this.i18n('Subscribed'), 65 this.i18n('Subscribed to {{nameWithHost}}', { nameWithHost: this.videoChannel.displayName }),
67 this.i18n('Subscribed to {{nameWithHost}}', { nameWithHost: this.videoChannel.displayName }) 66 this.i18n('Subscribed')
68 ) 67 )
69 }, 68 },
70 69
71 err => this.notificationsService.error(this.i18n('Error'), err.message) 70 err => this.notifier.error(err.message)
72 ) 71 )
73 } 72 }
74 73
@@ -84,13 +83,13 @@ export class SubscribeButtonComponent implements OnInit {
84 () => { 83 () => {
85 this.subscribed = false 84 this.subscribed = false
86 85
87 this.notificationsService.success( 86 this.notifier.success(
88 this.i18n('Unsubscribed'), 87 this.i18n('Unsubscribed from {{nameWithHost}}', { nameWithHost: this.videoChannel.displayName }),
89 this.i18n('Unsubscribed from {{nameWithHost}}', { nameWithHost: this.videoChannel.displayName }) 88 this.i18n('Unsubscribed')
90 ) 89 )
91 }, 90 },
92 91
93 err => this.notificationsService.error(this.i18n('Error'), err.message) 92 err => this.notifier.error(err.message)
94 ) 93 )
95 } 94 }
96 95
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts
index 2d32dd6ad..d234c8bfa 100644
--- a/client/src/app/shared/video/abstract-video-list.ts
+++ b/client/src/app/shared/video/abstract-video-list.ts
@@ -3,7 +3,6 @@ import { ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { Location } from '@angular/common' 4import { Location } from '@angular/common'
5import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' 5import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive'
6import { NotificationsService } from 'angular2-notifications'
7import { fromEvent, Observable, Subscription } from 'rxjs' 6import { fromEvent, Observable, Subscription } from 'rxjs'
8import { AuthService } from '../../core/auth' 7import { AuthService } from '../../core/auth'
9import { ComponentPagination } from '../rest/component-pagination.model' 8import { ComponentPagination } from '../rest/component-pagination.model'
@@ -13,6 +12,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
13import { ScreenService } from '@app/shared/misc/screen.service' 12import { ScreenService } from '@app/shared/misc/screen.service'
14import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' 13import { OwnerDisplayType } from '@app/shared/video/video-miniature.component'
15import { Syndication } from '@app/shared/video/syndication.model' 14import { Syndication } from '@app/shared/video/syndication.model'
15import { Notifier } from '@app/core'
16 16
17export abstract class AbstractVideoList implements OnInit, OnDestroy { 17export abstract class AbstractVideoList implements OnInit, OnDestroy {
18 private static LINES_PER_PAGE = 4 18 private static LINES_PER_PAGE = 4
@@ -43,7 +43,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
43 protected baseVideoWidth = 215 43 protected baseVideoWidth = 215
44 protected baseVideoHeight = 205 44 protected baseVideoHeight = 205
45 45
46 protected abstract notificationsService: NotificationsService 46 protected abstract notifier: Notifier
47 protected abstract authService: AuthService 47 protected abstract authService: AuthService
48 protected abstract router: Router 48 protected abstract router: Router
49 protected abstract route: ActivatedRoute 49 protected abstract route: ActivatedRoute
@@ -157,7 +157,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
157 }, 157 },
158 error => { 158 error => {
159 this.loadingPage[page] = false 159 this.loadingPage[page] = false
160 this.notificationsService.error(this.i18n('Error'), error.message) 160 this.notifier.error(error.message)
161 } 161 }
162 ) 162 )
163 } 163 }