From 211239ed949da6b1cd4e554b374fd875e2bfb5e4 Mon Sep 17 00:00:00 2001 From: Micah Elizabeth Scott Date: Sun, 7 Oct 2018 13:07:14 -0700 Subject: remove confirm modal for asset injection in edit-custom-config (#1219) --- .../edit-custom-config.component.ts | 24 ---------------------- 1 file changed, 24 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 4983b0425..25b303f44 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -1,6 +1,5 @@ import { Component, OnInit } from '@angular/core' import { ConfigService } from '@app/+admin/config/shared/config.service' -import { ConfirmService } from '@app/core' import { ServerService } from '@app/core/server/server.service' import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared' import { NotificationsService } from 'angular2-notifications' @@ -29,7 +28,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { private notificationsService: NotificationsService, private configService: ConfigService, private serverService: ServerService, - private confirmService: ConfirmService, private i18n: I18n ) { super() @@ -124,28 +122,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } async formValidated () { - const newCustomizationJavascript = this.form.value['customizationJavascript'] - const newCustomizationCSS = this.form.value['customizationCSS'] - - const customizations = [] - if (newCustomizationJavascript && newCustomizationJavascript !== this.oldCustomJavascript) customizations.push('JavaScript') - if (newCustomizationCSS && newCustomizationCSS !== this.oldCustomCSS) customizations.push('CSS') - - if (customizations.length !== 0) { - const customizationsText = customizations.join('/') - - // FIXME: i18n service does not support string concatenation - const message = this.i18n('You set custom {{customizationsText}}. ', { customizationsText }) + - this.i18n('This could lead to security issues or bugs if you do not understand it. ') + - this.i18n('Are you sure you want to update the configuration?') - - const label = this.i18n('Please type') + ` "I understand the ${customizationsText} I set" ` + this.i18n('to confirm.') - const expectedInputValue = `I understand the ${customizationsText} I set` - - const confirmRes = await this.confirmService.confirmWithInput(message, label, expectedInputValue) - if (confirmRes === false) return - } - const data: CustomConfig = { instance: { name: this.form.value['instanceName'], -- cgit v1.2.3 From 791645e620fb98c6e7c32271d91d91ff7e41b892 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Oct 2018 15:15:11 +0200 Subject: Add bulk actions in users table --- .../users/user-list/user-list.component.html | 31 +++++++- .../users/user-list/user-list.component.scss | 11 +++ .../+admin/users/user-list/user-list.component.ts | 93 +++++++++++++++++++++- 3 files changed, 129 insertions(+), 6 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index cca057ba1..9d1f2e34a 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html @@ -10,10 +10,31 @@ + +
+
+ + +
+ +
+ +
+
+
+ + + Username Email Video quota @@ -25,12 +46,17 @@ - + + + + + + {{ user.username }} (banned) @@ -40,7 +66,7 @@ {{ user.roleLabel }} {{ user.createdAt }} - + @@ -56,3 +82,4 @@
+ diff --git a/client/src/app/+admin/users/user-list/user-list.component.scss b/client/src/app/+admin/users/user-list/user-list.component.scss index 47291918d..01f43dfe1 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.scss +++ b/client/src/app/+admin/users/user-list/user-list.component.scss @@ -15,4 +15,15 @@ tr.banned { .ban-reason-label { font-weight: $font-semibold; +} + +.caption { + height: 40px; + display: flex; + justify-content: space-between; + align-items: center; + + input { + @include peertube-input-text(250px); + } } \ No newline at end of file diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index dee3ed643..f3e7e0ead 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -1,10 +1,12 @@ -import { Component, OnInit } from '@angular/core' +import { Component, OnInit, ViewChild } from '@angular/core' import { NotificationsService } from 'angular2-notifications' import { SortMeta } from 'primeng/components/common/sortmeta' import { ConfirmService } from '../../../core' import { RestPagination, RestTable, UserService } from '../../../shared' import { I18n } from '@ngx-translate/i18n-polyfill' import { User } from '../../../../../../shared' +import { UserBanModalComponent } from '@app/shared/moderation' +import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' @Component({ selector: 'my-user-list', @@ -12,12 +14,17 @@ import { User } from '../../../../../../shared' styleUrls: [ './user-list.component.scss' ] }) export class UserListComponent extends RestTable implements OnInit { + @ViewChild('userBanModal') userBanModal: UserBanModalComponent + users: User[] = [] totalRecords = 0 rowsPerPage = 10 sort: SortMeta = { field: 'createdAt', order: 1 } pagination: RestPagination = { count: this.rowsPerPage, start: 0 } + selectedUsers: User[] = [] + bulkUserActions: DropdownAction[] = [] + constructor ( private notificationsService: NotificationsService, private confirmService: ConfirmService, @@ -29,13 +36,28 @@ export class UserListComponent extends RestTable implements OnInit { ngOnInit () { this.loadSort() - } - onUserChanged () { - this.loadData() + this.bulkUserActions = [ + { + label: this.i18n('Delete'), + handler: users => this.removeUsers(users) + }, + { + label: this.i18n('Ban'), + handler: users => this.openBanUserModal(users), + isDisplayed: users => users.every(u => u.blocked === false) + }, + { + label: this.i18n('Unban'), + handler: users => this.unbanUsers(users), + isDisplayed: users => users.every(u => u.blocked === true) + } + ] } protected loadData () { + this.selectedUsers = [] + this.userService.getUsers(this.pagination, this.sort) .subscribe( resultList => { @@ -46,4 +68,67 @@ export class UserListComponent extends RestTable implements OnInit { err => this.notificationsService.error(this.i18n('Error'), err.message) ) } + + openBanUserModal (users: User[]) { + for (const user of users) { + if (user.username === 'root') { + this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot ban root.')) + return + } + } + + this.userBanModal.openModal(users) + } + + onUsersBanned () { + this.loadData() + } + + async unbanUsers (users: User[]) { + const message = this.i18n('Do you really want to unban {{num}} users?', { num: users.length }) + + const res = await this.confirmService.confirm(message, this.i18n('Unban')) + if (res === false) return + + this.userService.unbanUsers(users) + .subscribe( + () => { + const message = this.i18n('{{num}} users unbanned.', { num: users.length }) + + this.notificationsService.success(this.i18n('Success'), message) + this.loadData() + }, + + err => this.notificationsService.error(this.i18n('Error'), err.message) + ) + } + + async removeUsers (users: User[]) { + for (const user of users) { + if (user.username === 'root') { + this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot delete root.')) + return + } + } + + const message = this.i18n('If you remove these users, you will not be able to create others with the same username!') + const res = await this.confirmService.confirm(message, this.i18n('Delete')) + if (res === false) return + + this.userService.removeUser(users).subscribe( + () => { + this.notificationsService.success( + this.i18n('Success'), + this.i18n('{{num}} users deleted.', { num: users.length }) + ) + this.loadData() + }, + + err => this.notificationsService.error(this.i18n('Error'), err.message) + ) + } + + isInSelectionMode () { + return this.selectedUsers.length !== 0 + } } -- cgit v1.2.3 From 24b9417cec5cc785a57b2fe169a1ae88b88801a4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Oct 2018 15:51:38 +0200 Subject: Add users search filter --- .../src/app/+admin/follows/followers-list/followers-list.component.ts | 2 +- .../src/app/+admin/follows/following-list/following-list.component.ts | 2 +- client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts | 2 +- .../+admin/moderation/video-abuse-list/video-abuse-list.component.ts | 2 +- .../moderation/video-blacklist-list/video-blacklist-list.component.ts | 2 +- client/src/app/+admin/users/user-list/user-list.component.html | 1 + client/src/app/+admin/users/user-list/user-list.component.ts | 4 ++-- 7 files changed, 8 insertions(+), 7 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index ca993dcd3..4a25b7ff3 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts @@ -28,7 +28,7 @@ export class FollowersListComponent extends RestTable implements OnInit { } ngOnInit () { - this.loadSort() + this.initialize() } protected loadData () { diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index dd57884c6..70235a48d 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts @@ -29,7 +29,7 @@ export class FollowingListComponent extends RestTable implements OnInit { } ngOnInit () { - this.loadSort() + this.initialize() } async removeFollowing (follow: ActorFollow) { diff --git a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts index 866ba1b23..44778ab56 100644 --- a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts +++ b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts @@ -34,7 +34,7 @@ export class JobsListComponent extends RestTable implements OnInit { ngOnInit () { this.loadJobState() - this.loadSort() + this.initialize() } onJobStateChanged () { diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index 681db7434..9837af586 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts @@ -57,7 +57,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { } ngOnInit () { - this.loadSort() + this.initialize() } openModerationCommentModal (videoAbuse: VideoAbuse) { diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts index bb051d00f..e491edaca 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts @@ -39,7 +39,7 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { } ngOnInit () { - this.loadSort() + this.initialize() } getVideoUrl (videoBlacklist: VideoBlacklist) { diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index 9d1f2e34a..ae8921802 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html @@ -25,6 +25,7 @@
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index f3e7e0ead..33384dc35 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -35,7 +35,7 @@ export class UserListComponent extends RestTable implements OnInit { } ngOnInit () { - this.loadSort() + this.initialize() this.bulkUserActions = [ { @@ -58,7 +58,7 @@ export class UserListComponent extends RestTable implements OnInit { protected loadData () { this.selectedUsers = [] - this.userService.getUsers(this.pagination, this.sort) + this.userService.getUsers(this.pagination, this.sort, this.search) .subscribe( resultList => { this.users = resultList.data -- cgit v1.2.3 From 2cae5f13076a31aa95774679aed1f13c3bd5f8ce Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Oct 2018 16:15:10 +0200 Subject: Add checkbox to check every rows --- client/src/app/+admin/users/user-list/user-list.component.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index ae8921802..afa9ccfe4 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html @@ -33,9 +33,10 @@ - + + Username Email Video quota -- cgit v1.2.3 From b014b6b9c7cb68d09c52b44046afe486c0736426 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 10 Oct 2018 09:43:53 +0200 Subject: Add ability to search on followers/following --- .../follows/followers-list/followers-list.component.html | 9 +++++++++ .../follows/followers-list/followers-list.component.scss | 10 ++++++++++ .../follows/following-list/following-list.component.html | 11 +++++++++++ .../follows/following-list/following-list.component.scss | 8 ++++++++ .../+admin/follows/following-list/following-list.component.ts | 2 +- client/src/app/+admin/follows/shared/follow.service.ts | 8 ++++++-- .../src/app/+admin/users/user-list/user-list.component.scss | 3 --- 7 files changed, 45 insertions(+), 6 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.html b/client/src/app/+admin/follows/followers-list/followers-list.component.html index 5645a60cc..fc022bdb4 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.html +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.html @@ -2,6 +2,15 @@ [value]="followers" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" > + +
+ +
+
+ ID diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.scss b/client/src/app/+admin/follows/followers-list/followers-list.component.scss index e69de29bb..a6f0656b8 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.scss +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.scss @@ -0,0 +1,10 @@ +@import '_variables'; +@import '_mixins'; + +.caption { + justify-content: flex-end; + + input { + @include peertube-input-text(250px); + } +} \ No newline at end of file diff --git a/client/src/app/+admin/follows/following-list/following-list.component.html b/client/src/app/+admin/follows/following-list/following-list.component.html index 8af624ac5..5bc8fbc2d 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.html +++ b/client/src/app/+admin/follows/following-list/following-list.component.html @@ -2,6 +2,17 @@ [value]="following" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" > + +
+
+ +
+
+
+ ID diff --git a/client/src/app/+admin/follows/following-list/following-list.component.scss b/client/src/app/+admin/follows/following-list/following-list.component.scss index bfcdcaa49..b3bb7f5f8 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.scss +++ b/client/src/app/+admin/follows/following-list/following-list.component.scss @@ -10,4 +10,12 @@ my-redundancy-checkbox /deep/ my-peertube-checkbox { label { margin: 0; } +} + +.caption { + justify-content: flex-end; + + input { + @include peertube-input-text(250px); + } } \ No newline at end of file diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index 70235a48d..9b7029f75 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts @@ -53,7 +53,7 @@ export class FollowingListComponent extends RestTable implements OnInit { } protected loadData () { - this.followService.getFollowing(this.pagination, this.sort) + this.followService.getFollowing(this.pagination, this.sort, this.search) .subscribe( resultList => { this.following = resultList.data diff --git a/client/src/app/+admin/follows/shared/follow.service.ts b/client/src/app/+admin/follows/shared/follow.service.ts index 27169a9cd..a2904179e 100644 --- a/client/src/app/+admin/follows/shared/follow.service.ts +++ b/client/src/app/+admin/follows/shared/follow.service.ts @@ -18,10 +18,12 @@ export class FollowService { ) { } - getFollowing (pagination: RestPagination, sort: SortMeta): Observable> { + getFollowing (pagination: RestPagination, sort: SortMeta, search?: string): Observable> { let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) + if (search) params = params.append('search', search) + return this.authHttp.get>(FollowService.BASE_APPLICATION_URL + '/following', { params }) .pipe( map(res => this.restExtractor.convertResultListDateToHuman(res)), @@ -29,10 +31,12 @@ export class FollowService { ) } - getFollowers (pagination: RestPagination, sort: SortMeta): Observable> { + getFollowers (pagination: RestPagination, sort: SortMeta, search?: string): Observable> { let params = new HttpParams() params = this.restService.addRestGetParams(params, pagination, sort) + if (search) params = params.append('search', search) + return this.authHttp.get>(FollowService.BASE_APPLICATION_URL + '/followers', { params }) .pipe( map(res => this.restExtractor.convertResultListDateToHuman(res)), diff --git a/client/src/app/+admin/users/user-list/user-list.component.scss b/client/src/app/+admin/users/user-list/user-list.component.scss index 01f43dfe1..f235769f0 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.scss +++ b/client/src/app/+admin/users/user-list/user-list.component.scss @@ -18,10 +18,7 @@ tr.banned { } .caption { - height: 40px; - display: flex; justify-content: space-between; - align-items: center; input { @include peertube-input-text(250px); -- cgit v1.2.3 From 017c3dcadf71aef4c1a854e4867b77931747f06e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 10 Oct 2018 14:35:55 +0200 Subject: Add ability to list all local videos on client --- .../follows/following-list/following-list.component.scss | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/follows/following-list/following-list.component.scss b/client/src/app/+admin/follows/following-list/following-list.component.scss index b3bb7f5f8..a6f0656b8 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.scss +++ b/client/src/app/+admin/follows/following-list/following-list.component.scss @@ -1,17 +1,6 @@ @import '_variables'; @import '_mixins'; -my-redundancy-checkbox /deep/ my-peertube-checkbox { - .form-group { - margin-bottom: 0; - align-items: center; - } - - label { - margin: 0; - } -} - .caption { justify-content: flex-end; -- cgit v1.2.3 From 6ca76832fde247a33cb2ee94208f492801d1791a Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Mon, 15 Oct 2018 18:53:06 +0200 Subject: improve description of the HTTP video import feature --- .../+admin/config/edit-custom-config/edit-custom-config.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index e2cbd35ca..dfbbfbb29 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html @@ -112,7 +112,7 @@ Date: Tue, 16 Oct 2018 01:04:50 +0200 Subject: update tslint config and fix member ordering (#1279) --- client/src/app/+admin/users/user-edit/user-edit.ts | 1 - .../+admin/users/user-list/user-list.component.ts | 28 +++++++++++----------- 2 files changed, 14 insertions(+), 15 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 07b087b5b..99ce5804b 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -1,7 +1,6 @@ import { ServerService } from '../../../core' import { FormReactive } from '../../../shared' import { USER_ROLE_LABELS, VideoResolution } from '../../../../../../shared' -import { EditCustomConfigComponent } from '../../../+admin/config/edit-custom-config/' import { ConfigService } from '@app/+admin/config/shared/config.service' export abstract class UserEdit extends FormReactive { diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 33384dc35..ab2250722 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -55,20 +55,6 @@ export class UserListComponent extends RestTable implements OnInit { ] } - protected loadData () { - this.selectedUsers = [] - - this.userService.getUsers(this.pagination, this.sort, this.search) - .subscribe( - resultList => { - this.users = resultList.data - this.totalRecords = resultList.total - }, - - err => this.notificationsService.error(this.i18n('Error'), err.message) - ) - } - openBanUserModal (users: User[]) { for (const user of users) { if (user.username === 'root') { @@ -131,4 +117,18 @@ export class UserListComponent extends RestTable implements OnInit { isInSelectionMode () { return this.selectedUsers.length !== 0 } + + protected loadData () { + this.selectedUsers = [] + + this.userService.getUsers(this.pagination, this.sort, this.search) + .subscribe( + resultList => { + this.users = resultList.data + this.totalRecords = resultList.total + }, + + err => this.notificationsService.error(this.i18n('Error'), err.message) + ) + } } -- cgit v1.2.3 From af5767ffae41b2d5604e41ba9a7225c623dd6735 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Oct 2018 17:26:40 +0200 Subject: Add user/instance block by users in the client --- .../moderation/video-abuse-list/video-abuse-list.component.html | 2 +- .../video-blacklist-list/video-blacklist-list.component.html | 2 +- client/src/app/+admin/users/user-list/user-list.component.html | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html index 287ab3e46..0374b70ef 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html @@ -9,7 +9,7 @@ Created Video State - + diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html index 0585e0490..ff4543b97 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html @@ -8,7 +8,7 @@ Video name Sensitive Date - +
diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index afa9ccfe4..eb8d30e17 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html @@ -60,8 +60,10 @@ - {{ user.username }} - (banned) + + {{ user.username }} + (banned) + {{ user.email }} {{ user.videoQuotaUsed }} / {{ user.videoQuota }} -- cgit v1.2.3 From 65b21c961c69c4a63c7c0c34be3d6d034a1176c7 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 15 Oct 2018 16:43:14 +0200 Subject: Add ability to mute a user/instance by server in client --- client/src/app/+admin/admin.module.ts | 3 ++ .../+admin/moderation/instance-blocklist/index.ts | 2 + .../instance-account-blocklist.component.html | 22 ++++++++ .../instance-account-blocklist.component.scss | 7 +++ .../instance-account-blocklist.component.ts | 59 +++++++++++++++++++++ .../instance-server-blocklist.component.html | 23 +++++++++ .../instance-server-blocklist.component.scss | 7 +++ .../instance-server-blocklist.component.ts | 60 ++++++++++++++++++++++ .../+admin/moderation/moderation.component.html | 4 ++ .../app/+admin/moderation/moderation.component.ts | 8 +++ .../src/app/+admin/moderation/moderation.routes.ts | 23 +++++++++ 11 files changed, 218 insertions(+) create mode 100644 client/src/app/+admin/moderation/instance-blocklist/index.ts create mode 100644 client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html create mode 100644 client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.scss create mode 100644 client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts create mode 100644 client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html create mode 100644 client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.scss create mode 100644 client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts index 8c6db98d9..c06ae1d60 100644 --- a/client/src/app/+admin/admin.module.ts +++ b/client/src/app/+admin/admin.module.ts @@ -15,6 +15,7 @@ import { ModerationCommentModalComponent, VideoAbuseListComponent, VideoBlacklis import { ModerationComponent } from '@app/+admin/moderation/moderation.component' import { RedundancyCheckboxComponent } from '@app/+admin/follows/shared/redundancy-checkbox.component' import { RedundancyService } from '@app/+admin/follows/shared/redundancy.service' +import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from '@app/+admin/moderation/instance-blocklist' @NgModule({ imports: [ @@ -41,6 +42,8 @@ import { RedundancyService } from '@app/+admin/follows/shared/redundancy.service VideoBlacklistListComponent, VideoAbuseListComponent, ModerationCommentModalComponent, + InstanceServerBlocklistComponent, + InstanceAccountBlocklistComponent, JobsComponent, JobsListComponent, diff --git a/client/src/app/+admin/moderation/instance-blocklist/index.ts b/client/src/app/+admin/moderation/instance-blocklist/index.ts new file mode 100644 index 000000000..3e7a344bb --- /dev/null +++ b/client/src/app/+admin/moderation/instance-blocklist/index.ts @@ -0,0 +1,2 @@ +export * from './instance-account-blocklist.component' +export * from './instance-server-blocklist.component' diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html new file mode 100644 index 000000000..7797bc56e --- /dev/null +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.html @@ -0,0 +1,22 @@ + + + + + Account + Muted at + + + + + + {{ accountBlock.blockedAccount.nameWithHost }} + {{ accountBlock.createdAt }} + + + + + + diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.scss b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.scss new file mode 100644 index 000000000..6028b75ea --- /dev/null +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.scss @@ -0,0 +1,7 @@ +@import '_variables'; +@import '_mixins'; + +.unblock-button { + @include peertube-button; + @include grey-button; +} \ No newline at end of file diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts new file mode 100644 index 000000000..3f243aee4 --- /dev/null +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts @@ -0,0 +1,59 @@ +import { Component, OnInit } from '@angular/core' +import { NotificationsService } from 'angular2-notifications' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { RestPagination, RestTable } from '@app/shared' +import { SortMeta } from 'primeng/components/common/sortmeta' +import { BlocklistService, AccountBlock } from '@app/shared/blocklist' + +@Component({ + selector: 'my-instance-account-blocklist', + styleUrls: [ './instance-account-blocklist.component.scss' ], + templateUrl: './instance-account-blocklist.component.html' +}) +export class InstanceAccountBlocklistComponent extends RestTable implements OnInit { + blockedAccounts: AccountBlock[] = [] + totalRecords = 0 + rowsPerPage = 10 + sort: SortMeta = { field: 'createdAt', order: -1 } + pagination: RestPagination = { count: this.rowsPerPage, start: 0 } + + constructor ( + private notificationsService: NotificationsService, + private blocklistService: BlocklistService, + private i18n: I18n + ) { + super() + } + + ngOnInit () { + this.initialize() + } + + unblockAccount (accountBlock: AccountBlock) { + const blockedAccount = accountBlock.blockedAccount + + this.blocklistService.unblockAccountByInstance(blockedAccount) + .subscribe( + () => { + this.notificationsService.success( + this.i18n('Success'), + this.i18n('Account {{nameWithHost}} unmuted by your instance.', { nameWithHost: blockedAccount.nameWithHost }) + ) + + this.loadData() + } + ) + } + + protected loadData () { + return this.blocklistService.getInstanceAccountBlocklist(this.pagination, this.sort) + .subscribe( + resultList => { + this.blockedAccounts = resultList.data + this.totalRecords = resultList.total + }, + + err => this.notificationsService.error(this.i18n('Error'), err.message) + ) + } +} diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html new file mode 100644 index 000000000..859c0f916 --- /dev/null +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html @@ -0,0 +1,23 @@ + + + + + Instance + Muted at + + + + + + + {{ serverBlock.blockedServer.host }} + {{ serverBlock.createdAt }} + + + + + + diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.scss b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.scss new file mode 100644 index 000000000..6028b75ea --- /dev/null +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.scss @@ -0,0 +1,7 @@ +@import '_variables'; +@import '_mixins'; + +.unblock-button { + @include peertube-button; + @include grey-button; +} \ No newline at end of file diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts new file mode 100644 index 000000000..9459117a3 --- /dev/null +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts @@ -0,0 +1,60 @@ +import { Component, OnInit } from '@angular/core' +import { NotificationsService } from 'angular2-notifications' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { RestPagination, RestTable } from '@app/shared' +import { SortMeta } from 'primeng/components/common/sortmeta' +import { BlocklistService } from '@app/shared/blocklist' +import { ServerBlock } from '../../../../../../shared' + +@Component({ + selector: 'my-instance-server-blocklist', + styleUrls: [ './instance-server-blocklist.component.scss' ], + templateUrl: './instance-server-blocklist.component.html' +}) +export class InstanceServerBlocklistComponent extends RestTable implements OnInit { + blockedAccounts: ServerBlock[] = [] + totalRecords = 0 + rowsPerPage = 10 + sort: SortMeta = { field: 'createdAt', order: -1 } + pagination: RestPagination = { count: this.rowsPerPage, start: 0 } + + constructor ( + private notificationsService: NotificationsService, + private blocklistService: BlocklistService, + private i18n: I18n + ) { + super() + } + + ngOnInit () { + this.initialize() + } + + unblockServer (serverBlock: ServerBlock) { + const host = serverBlock.blockedServer.host + + this.blocklistService.unblockServerByInstance(host) + .subscribe( + () => { + this.notificationsService.success( + this.i18n('Success'), + this.i18n('Instance {{host}} unmuted by your instance.', { host }) + ) + + this.loadData() + } + ) + } + + protected loadData () { + return this.blocklistService.getInstanceServerBlocklist(this.pagination, this.sort) + .subscribe( + resultList => { + this.blockedAccounts = resultList.data + this.totalRecords = resultList.total + }, + + err => this.notificationsService.error(this.i18n('Error'), err.message) + ) + } +} diff --git a/client/src/app/+admin/moderation/moderation.component.html b/client/src/app/+admin/moderation/moderation.component.html index 91e87fcd4..8ec7278ef 100644 --- a/client/src/app/+admin/moderation/moderation.component.html +++ b/client/src/app/+admin/moderation/moderation.component.html @@ -5,6 +5,10 @@ Video abuses Blacklisted videos + + Muted accounts + + Muted servers diff --git a/client/src/app/+admin/moderation/moderation.component.ts b/client/src/app/+admin/moderation/moderation.component.ts index 0f4efb970..7f85f920e 100644 --- a/client/src/app/+admin/moderation/moderation.component.ts +++ b/client/src/app/+admin/moderation/moderation.component.ts @@ -16,4 +16,12 @@ export class ModerationComponent { hasVideoBlacklistRight () { return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) } + + hasAccountsBlacklistRight () { + return this.auth.getUser().hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST) + } + + hasServersBlacklistRight () { + return this.auth.getUser().hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST) + } } diff --git a/client/src/app/+admin/moderation/moderation.routes.ts b/client/src/app/+admin/moderation/moderation.routes.ts index 6d81b9b36..bc6dd49d5 100644 --- a/client/src/app/+admin/moderation/moderation.routes.ts +++ b/client/src/app/+admin/moderation/moderation.routes.ts @@ -4,6 +4,7 @@ import { UserRightGuard } from '@app/core' import { VideoAbuseListComponent } from '@app/+admin/moderation/video-abuse-list' import { VideoBlacklistListComponent } from '@app/+admin/moderation/video-blacklist-list' import { ModerationComponent } from '@app/+admin/moderation/moderation.component' +import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } from '@app/+admin/moderation/instance-blocklist' export const ModerationRoutes: Routes = [ { @@ -46,6 +47,28 @@ export const ModerationRoutes: Routes = [ title: 'Blacklisted videos' } } + }, + { + path: 'blocklist/accounts', + component: InstanceAccountBlocklistComponent, + canActivate: [ UserRightGuard ], + data: { + userRight: UserRight.MANAGE_ACCOUNTS_BLOCKLIST, + meta: { + title: 'Muted accounts' + } + } + }, + { + path: 'blocklist/servers', + component: InstanceServerBlocklistComponent, + canActivate: [ UserRightGuard ], + data: { + userRight: UserRight.MANAGE_SERVER_REDUNDANCY, + meta: { + title: 'Muted instances' + } + } } ] } -- cgit v1.2.3 From 92ea70a782181b987b3547a0d5816e314efb5112 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 16 Oct 2018 11:51:28 +0200 Subject: Fix code typos --- .../instance-blocklist/instance-server-blocklist.component.html | 2 +- .../instance-blocklist/instance-server-blocklist.component.ts | 4 ++-- client/src/app/+admin/moderation/moderation.component.html | 4 ++-- client/src/app/+admin/moderation/moderation.component.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html index 859c0f916..f634ba834 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.html @@ -1,5 +1,5 @@ diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts index 9459117a3..130009dc7 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts @@ -12,7 +12,7 @@ import { ServerBlock } from '../../../../../../shared' templateUrl: './instance-server-blocklist.component.html' }) export class InstanceServerBlocklistComponent extends RestTable implements OnInit { - blockedAccounts: ServerBlock[] = [] + blockedServers: ServerBlock[] = [] totalRecords = 0 rowsPerPage = 10 sort: SortMeta = { field: 'createdAt', order: -1 } @@ -50,7 +50,7 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni return this.blocklistService.getInstanceServerBlocklist(this.pagination, this.sort) .subscribe( resultList => { - this.blockedAccounts = resultList.data + this.blockedServers = resultList.data this.totalRecords = resultList.total }, diff --git a/client/src/app/+admin/moderation/moderation.component.html b/client/src/app/+admin/moderation/moderation.component.html index 8ec7278ef..01457936c 100644 --- a/client/src/app/+admin/moderation/moderation.component.html +++ b/client/src/app/+admin/moderation/moderation.component.html @@ -6,9 +6,9 @@ Blacklisted videos - Muted accounts + Muted accounts - Muted servers + Muted servers diff --git a/client/src/app/+admin/moderation/moderation.component.ts b/client/src/app/+admin/moderation/moderation.component.ts index 7f85f920e..2b2618933 100644 --- a/client/src/app/+admin/moderation/moderation.component.ts +++ b/client/src/app/+admin/moderation/moderation.component.ts @@ -17,11 +17,11 @@ export class ModerationComponent { return this.auth.getUser().hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) } - hasAccountsBlacklistRight () { + hasAccountsBlocklistRight () { return this.auth.getUser().hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST) } - hasServersBlacklistRight () { + hasServersBlocklistRight () { return this.auth.getUser().hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST) } } -- cgit v1.2.3 From 244b4ae3973bc1511464a08158a123767f83179c Mon Sep 17 00:00:00 2001 From: BO41 Date: Thu, 18 Oct 2018 09:08:59 +0200 Subject: NoImplicitAny flag true (#1157) this enables the `noImplicitAny` flag in the Typescript compiler > When the noImplicitAny flag is true and the TypeScript compiler cannot infer the type, it still generates the JavaScript files, but it also reports an error. Many seasoned developers prefer this stricter setting because type checking catches more unintentional errors at compile time. closes: #1131 replaces #1137 --- .../+admin/config/edit-custom-config/edit-custom-config.component.ts | 4 ++-- client/src/app/+admin/users/user-edit/user-edit.ts | 2 +- client/src/app/+admin/users/user-list/user-list.component.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 25b303f44..9a9298825 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -62,7 +62,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } ngOnInit () { - const formGroupData = { + const formGroupData: any = { instanceName: this.customConfigValidatorsService.INSTANCE_NAME, instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION, instanceDescription: null, @@ -202,7 +202,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } private updateForm () { - const data = { + const data: any = { instanceName: this.customConfig.instance.name, instanceShortDescription: this.customConfig.instance.shortDescription, instanceDescription: this.customConfig.instance.description, diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 99ce5804b..a4d696e69 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -7,7 +7,7 @@ export abstract class UserEdit extends FormReactive { videoQuotaOptions: { value: string, label: string }[] = [] videoQuotaDailyOptions: { value: string, label: string }[] = [] - roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) + roles = Object.keys(USER_ROLE_LABELS).map((key: any) => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) protected abstract serverService: ServerService protected abstract configService: ConfigService diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index ab2250722..0d7f88d2b 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -45,12 +45,12 @@ export class UserListComponent extends RestTable implements OnInit { { label: this.i18n('Ban'), handler: users => this.openBanUserModal(users), - isDisplayed: users => users.every(u => u.blocked === false) + isDisplayed: users => users.every((u: any) => u.blocked === false) }, { label: this.i18n('Unban'), handler: users => this.unbanUsers(users), - isDisplayed: users => users.every(u => u.blocked === true) + isDisplayed: users => users.every((u: any) => u.blocked === true) } ] } -- cgit v1.2.3 From c199c427d4ae586339822320f20f512a7a19dc3f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Oct 2018 14:35:31 +0200 Subject: Better typings --- .../config/edit-custom-config/edit-custom-config.component.ts | 4 ++-- client/src/app/+admin/users/user-edit/user-edit.ts | 2 +- client/src/app/+admin/users/user-list/user-list.component.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 9a9298825..f48b6fc1a 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -62,7 +62,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } ngOnInit () { - const formGroupData: any = { + const formGroupData: { [key: string]: any } = { instanceName: this.customConfigValidatorsService.INSTANCE_NAME, instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION, instanceDescription: null, @@ -202,7 +202,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } private updateForm () { - const data: any = { + const data: { [key: string]: any } = { instanceName: this.customConfig.instance.name, instanceShortDescription: this.customConfig.instance.shortDescription, instanceDescription: this.customConfig.instance.description, diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index a4d696e69..99ce5804b 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -7,7 +7,7 @@ export abstract class UserEdit extends FormReactive { videoQuotaOptions: { value: string, label: string }[] = [] videoQuotaDailyOptions: { value: string, label: string }[] = [] - roles = Object.keys(USER_ROLE_LABELS).map((key: any) => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) + roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) protected abstract serverService: ServerService protected abstract configService: ConfigService diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 0d7f88d2b..3859af9ff 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -23,7 +23,7 @@ export class UserListComponent extends RestTable implements OnInit { pagination: RestPagination = { count: this.rowsPerPage, start: 0 } selectedUsers: User[] = [] - bulkUserActions: DropdownAction[] = [] + bulkUserActions: DropdownAction[] = [] constructor ( private notificationsService: NotificationsService, @@ -45,12 +45,12 @@ export class UserListComponent extends RestTable implements OnInit { { label: this.i18n('Ban'), handler: users => this.openBanUserModal(users), - isDisplayed: users => users.every((u: any) => u.blocked === false) + isDisplayed: users => users.every(u => u.blocked === false) }, { label: this.i18n('Unban'), handler: users => this.unbanUsers(users), - isDisplayed: users => users.every((u: any) => u.blocked === true) + isDisplayed: users => users.every(u => u.blocked === true) } ] } -- cgit v1.2.3 From 5aa4a3dd05486a3c4910ffea888e5fae190bb53d Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 17 Oct 2018 20:04:50 -0600 Subject: Change "delete" to "delete this report" Closes #1295. --- .../+admin/moderation/video-abuse-list/video-abuse-list.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index 9837af586..188cbd7ac 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts @@ -36,7 +36,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { this.videoAbuseActions = [ { - label: this.i18n('Delete'), + label: this.i18n('Delete this report'), handler: videoAbuse => this.removeVideoAbuse(videoAbuse) }, { -- cgit v1.2.3 From 198d764ff08047ec469b21b1e8c54d8d29ef2b8d Mon Sep 17 00:00:00 2001 From: mike stedman Date: Wed, 17 Oct 2018 20:22:06 -0600 Subject: Make abuse-delete confirmation box clearer --- .../+admin/moderation/video-abuse-list/video-abuse-list.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index 188cbd7ac..7a219c846 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts @@ -85,7 +85,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { } async removeVideoAbuse (videoAbuse: VideoAbuse) { - const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this abuse?'), this.i18n('Delete')) + const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this abuse report?'), this.i18n('Delete')) if (res === false) return this.videoAbuseService.removeVideoAbuse(videoAbuse).subscribe( -- cgit v1.2.3 From 2fbe7f1933f4bd5de96e6428234e56965616120e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Nov 2018 09:24:56 +0100 Subject: Fix new Angular 7 issues --- client/src/app/+admin/users/user-edit/user-edit.ts | 2 +- client/src/app/+admin/users/user-list/user-list.component.html | 2 +- client/src/app/+admin/users/user-list/user-list.component.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 99ce5804b..0b3511e8e 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -4,10 +4,10 @@ import { USER_ROLE_LABELS, VideoResolution } from '../../../../../../shared' import { ConfigService } from '@app/+admin/config/shared/config.service' export abstract class UserEdit extends FormReactive { - videoQuotaOptions: { value: string, label: string }[] = [] videoQuotaDailyOptions: { value: string, label: string }[] = [] roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) + username: string protected abstract serverService: ServerService protected abstract configService: ConfigService diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index eb8d30e17..5684004a5 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html @@ -86,4 +86,4 @@
- + diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 3859af9ff..31e783622 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -66,7 +66,7 @@ export class UserListComponent extends RestTable implements OnInit { this.userBanModal.openModal(users) } - onUsersBanned () { + onUserChanged () { this.loadData() } -- cgit v1.2.3 From 361805c48b14c5402c9984485c67c45a1a3113cc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 19 Nov 2018 14:34:01 +0100 Subject: Fix checkbox margins --- .../edit-custom-config.component.html | 69 +++++++++++++--------- 1 file changed, 40 insertions(+), 29 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index dfbbfbb29..fd4d3d9c9 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html @@ -87,15 +87,19 @@
Signup
- +
+ +
- +
+ +
@@ -110,15 +114,19 @@
Import
- +
+ +
- +
+ +
Administrator
@@ -184,13 +192,15 @@
- +
+ +
@@ -199,11 +209,13 @@
Transcoding
- +
+ +
@@ -226,7 +238,6 @@ [inputName]="getResolutionKey(resolution)" [formControlName]="getResolutionKey(resolution)" i18n-labelText labelText="Resolution {{resolution}} enabled" > - -- cgit v1.2.3 From fc2ec87a8c4dcfbb91a1a62cf4c07a2a8e6a50fe Mon Sep 17 00:00:00 2001 From: Josh Morel Date: Wed, 21 Nov 2018 02:48:29 -0500 Subject: enable email verification by admin (#1348) * enable email verification by admin * rename/label to set email as verified to be more explicit that admin is not sending another email to confirm * add update user emailVerified check-params test * make user.model emailVerified property required --- .../users/user-list/user-list.component.html | 12 +++++++++- .../+admin/users/user-list/user-list.component.ts | 26 +++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index 5684004a5..556ab3c5d 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html @@ -65,7 +65,17 @@ (banned) - {{ user.email }} + {{ user.email }} + + + ? {{ user.email }} + + + + ✓ {{ user.email }} + + + {{ user.videoQuotaUsed }} / {{ user.videoQuota }} {{ user.roleLabel }} {{ user.createdAt }} diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 31e783622..fb085c133 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, ViewChild } from '@angular/core' import { NotificationsService } from 'angular2-notifications' import { SortMeta } from 'primeng/components/common/sortmeta' -import { ConfirmService } from '../../../core' +import { ConfirmService, ServerService } from '../../../core' import { RestPagination, RestTable, UserService } from '../../../shared' import { I18n } from '@ngx-translate/i18n-polyfill' import { User } from '../../../../../../shared' @@ -28,12 +28,17 @@ export class UserListComponent extends RestTable implements OnInit { constructor ( private notificationsService: NotificationsService, private confirmService: ConfirmService, + private serverService: ServerService, private userService: UserService, private i18n: I18n ) { super() } + get requiresEmailVerification () { + return this.serverService.getConfig().signup.requiresEmailVerification + } + ngOnInit () { this.initialize() @@ -51,6 +56,11 @@ export class UserListComponent extends RestTable implements OnInit { label: this.i18n('Unban'), handler: users => this.unbanUsers(users), isDisplayed: users => users.every(u => u.blocked === true) + }, + { + label: this.i18n('Set Email as Verified'), + handler: users => this.setEmailsAsVerified(users), + isDisplayed: users => this.requiresEmailVerification && users.every(u => !u.blocked && u.emailVerified === false) } ] } @@ -114,6 +124,20 @@ export class UserListComponent extends RestTable implements OnInit { ) } + async setEmailsAsVerified (users: User[]) { + this.userService.updateUsers(users, { emailVerified: true }).subscribe( + () => { + this.notificationsService.success( + this.i18n('Success'), + this.i18n('{{num}} users email set as verified.', { num: users.length }) + ) + this.loadData() + }, + + err => this.notificationsService.error(this.i18n('Error'), err.message) + ) + } + isInSelectionMode () { return this.selectedUsers.length !== 0 } -- cgit v1.2.3 From 14e2014acc1362cfbb770c051a7254b156cd8efb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Dec 2018 14:52:50 +0100 Subject: Support additional video extensions --- .../config/edit-custom-config/edit-custom-config.component.html | 8 ++++++++ .../config/edit-custom-config/edit-custom-config.component.ts | 3 +++ 2 files changed, 11 insertions(+) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index fd4d3d9c9..6ece7e8bc 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html @@ -219,6 +219,14 @@ +
+ +
+
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index f48b6fc1a..6eea1cd76 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -82,6 +82,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, userVideoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY, transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS, + transcodingAllowAdditionalExtensions: null, transcodingEnabled: null, customizationJavascript: null, customizationCSS: null @@ -163,6 +164,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { }, transcoding: { enabled: this.form.value['transcodingEnabled'], + allowAdditionalExtensions: this.form.value['transcodingAllowAdditionalExtensions'], threads: this.form.value['transcodingThreads'], resolutions: { '240p': this.form.value[this.getResolutionKey('240p')], @@ -221,6 +223,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { userVideoQuotaDaily: this.customConfig.user.videoQuotaDaily, transcodingThreads: this.customConfig.transcoding.threads, transcodingEnabled: this.customConfig.transcoding.enabled, + transcodingAllowAdditionalExtensions: this.customConfig.transcoding.allowAdditionalExtensions, customizationJavascript: this.customConfig.instance.customizations.javascript, customizationCSS: this.customConfig.instance.customizations.css, importVideosHttpEnabled: this.customConfig.import.videos.http.enabled, -- cgit v1.2.3 From 16c07398f2ed884b9223b3e18c5e541cf9ab8469 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 13 Dec 2018 15:00:10 +0100 Subject: Fix followers search --- .../src/app/+admin/follows/followers-list/followers-list.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index 4a25b7ff3..43ce5d4af 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts @@ -32,7 +32,7 @@ export class FollowersListComponent extends RestTable implements OnInit { } protected loadData () { - this.followService.getFollowers(this.pagination, this.sort) + this.followService.getFollowers(this.pagination, this.sort, this.search) .subscribe( resultList => { this.followers = resultList.data -- cgit v1.2.3 From f8b2c1b4f509c037b9650cca2c5befd21f056df3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 19 Dec 2018 16:04:34 +0100 Subject: Refractor notification service Shorter name and use primeng component --- .../edit-custom-config.component.ts | 10 +++--- .../followers-list/followers-list.component.ts | 6 ++-- .../following-add/following-add.component.ts | 8 ++--- .../following-list/following-list.component.ts | 13 +++---- .../shared/redundancy-checkbox.component.ts | 21 +++++------ .../+admin/jobs/jobs-list/jobs-list.component.ts | 6 ++-- .../instance-account-blocklist.component.ts | 11 +++--- .../instance-server-blocklist.component.ts | 11 +++--- .../moderation-comment-modal.component.ts | 25 ++++++------- .../video-abuse-list/video-abuse-list.component.ts | 15 ++++---- .../video-blacklist-list.component.ts | 13 +++---- .../users/user-edit/user-create.component.ts | 10 ++---- .../users/user-edit/user-update.component.ts | 9 ++--- .../+admin/users/user-list/user-list.component.ts | 42 ++++++++++------------ 14 files changed, 84 insertions(+), 116 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 6eea1cd76..ee877ee31 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core' import { ConfigService } from '@app/+admin/config/shared/config.service' import { ServerService } from '@app/core/server/server.service' import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' import { I18n } from '@ngx-translate/i18n-polyfill' import { BuildFormDefaultValues, FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' @@ -25,7 +25,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { protected formValidatorService: FormValidatorService, private customConfigValidatorsService: CustomConfigValidatorsService, private userValidatorsService: UserValidatorsService, - private notificationsService: NotificationsService, + private notifier: Notifier, private configService: ConfigService, private serverService: ServerService, private i18n: I18n @@ -110,7 +110,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { this.forceCheck() }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } @@ -196,10 +196,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { this.updateForm() - this.notificationsService.success(this.i18n('Success'), this.i18n('Configuration updated.')) + this.notifier.success(this.i18n('Configuration updated.')) }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index 43ce5d4af..9a8848bfb 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { SortMeta } from 'primeng/primeng' import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' import { RestPagination, RestTable } from '../../../shared' @@ -20,7 +20,7 @@ export class FollowersListComponent extends RestTable implements OnInit { pagination: RestPagination = { count: this.rowsPerPage, start: 0 } constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private followService: FollowService, private i18n: I18n ) { @@ -39,7 +39,7 @@ export class FollowersListComponent extends RestTable implements OnInit { this.totalRecords = resultList.total }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } } diff --git a/client/src/app/+admin/follows/following-add/following-add.component.ts b/client/src/app/+admin/follows/following-add/following-add.component.ts index bd9cc022b..2bb249746 100644 --- a/client/src/app/+admin/follows/following-add/following-add.component.ts +++ b/client/src/app/+admin/follows/following-add/following-add.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core' import { Router } from '@angular/router' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { ConfirmService } from '../../../core' import { validateHost } from '../../../shared' import { FollowService } from '../shared' @@ -18,7 +18,7 @@ export class FollowingAddComponent { constructor ( private router: Router, - private notificationsService: NotificationsService, + private notifier: Notifier, private confirmService: ConfirmService, private followService: FollowService, private i18n: I18n @@ -64,12 +64,12 @@ export class FollowingAddComponent { this.followService.follow(hosts).subscribe( () => { - this.notificationsService.success(this.i18n('Success'), this.i18n('Follow request(s) sent!')) + this.notifier.success(this.i18n('Follow request(s) sent!')) setTimeout(() => this.router.navigate([ '/admin/follows/following-list' ]), 500) }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index 9b7029f75..4517a721e 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { SortMeta } from 'primeng/primeng' import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' import { ConfirmService } from '../../../core/confirm/confirm.service' @@ -20,7 +20,7 @@ export class FollowingListComponent extends RestTable implements OnInit { pagination: RestPagination = { count: this.rowsPerPage, start: 0 } constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private confirmService: ConfirmService, private followService: FollowService, private i18n: I18n @@ -41,14 +41,11 @@ export class FollowingListComponent extends RestTable implements OnInit { this.followService.unfollow(follow).subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), - this.i18n('You are not following {{host}} anymore.', { host: follow.following.host }) - ) + this.notifier.success(this.i18n('You are not following {{host}} anymore.', { host: follow.following.host })) this.loadData() }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } @@ -60,7 +57,7 @@ export class FollowingListComponent extends RestTable implements OnInit { this.totalRecords = resultList.total }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } } diff --git a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts index 6d77a0eb4..fa1da26bf 100644 --- a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts +++ b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts @@ -1,5 +1,5 @@ import { Component, Input } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' import { RedundancyService } from '@app/+admin/follows/shared/redundancy.service' @@ -13,24 +13,21 @@ export class RedundancyCheckboxComponent { @Input() host: string constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private redundancyService: RedundancyService, private i18n: I18n ) { } updateRedundancyState () { this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed) - .subscribe( - () => { - const stateLabel = this.redundancyAllowed ? this.i18n('enabled') : this.i18n('disabled') + .subscribe( + () => { + const stateLabel = this.redundancyAllowed ? this.i18n('enabled') : this.i18n('disabled') - this.notificationsService.success( - this.i18n('Success'), - this.i18n('Redundancy for {{host}} is {{stateLabel}}', { host: this.host, stateLabel }) - ) - }, + this.notifier.success(this.i18n('Redundancy for {{host}} is {{stateLabel}}', { host: this.host, stateLabel })) + }, - err => this.notificationsService.error(this.i18n('Error'), err.message) - ) + err => this.notifier.error(err.message) + ) } } diff --git a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts index 44778ab56..b265e1dd6 100644 --- a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts +++ b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core' import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { SortMeta } from 'primeng/primeng' import { Job } from '../../../../../../shared/index' import { JobState } from '../../../../../../shared/models' @@ -25,7 +25,7 @@ export class JobsListComponent extends RestTable implements OnInit { pagination: RestPagination = { count: this.rowsPerPage, start: 0 } constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private jobsService: JobService, private i18n: I18n ) { @@ -53,7 +53,7 @@ export class JobsListComponent extends RestTable implements OnInit { this.totalRecords = resultList.total }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts index 3f243aee4..032bf745a 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts @@ -1,9 +1,9 @@ import { Component, OnInit } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' import { RestPagination, RestTable } from '@app/shared' import { SortMeta } from 'primeng/components/common/sortmeta' -import { BlocklistService, AccountBlock } from '@app/shared/blocklist' +import { AccountBlock, BlocklistService } from '@app/shared/blocklist' @Component({ selector: 'my-instance-account-blocklist', @@ -18,7 +18,7 @@ export class InstanceAccountBlocklistComponent extends RestTable implements OnIn pagination: RestPagination = { count: this.rowsPerPage, start: 0 } constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private blocklistService: BlocklistService, private i18n: I18n ) { @@ -35,8 +35,7 @@ export class InstanceAccountBlocklistComponent extends RestTable implements OnIn this.blocklistService.unblockAccountByInstance(blockedAccount) .subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), + this.notifier.success( this.i18n('Account {{nameWithHost}} unmuted by your instance.', { nameWithHost: blockedAccount.nameWithHost }) ) @@ -53,7 +52,7 @@ export class InstanceAccountBlocklistComponent extends RestTable implements OnIn this.totalRecords = resultList.total }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } } diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts index 130009dc7..db3dfcd1c 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' import { RestPagination, RestTable } from '@app/shared' import { SortMeta } from 'primeng/components/common/sortmeta' @@ -19,7 +19,7 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni pagination: RestPagination = { count: this.rowsPerPage, start: 0 } constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private blocklistService: BlocklistService, private i18n: I18n ) { @@ -36,10 +36,7 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni this.blocklistService.unblockServerByInstance(host) .subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), - this.i18n('Instance {{host}} unmuted by your instance.', { host }) - ) + this.notifier.success(this.i18n('Instance {{host}} unmuted by your instance.', { host })) this.loadData() } @@ -54,7 +51,7 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni this.totalRecords = resultList.total }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } } diff --git a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts index 34ab384d1..bebcb4207 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { FormReactive, VideoAbuseService, VideoAbuseValidatorsService } from '../../../shared' import { I18n } from '@ngx-translate/i18n-polyfill' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' @@ -22,7 +22,7 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI constructor ( protected formValidatorService: FormValidatorService, private modalService: NgbModal, - private notificationsService: NotificationsService, + private notifier: Notifier, private videoAbuseService: VideoAbuseService, private videoAbuseValidatorsService: VideoAbuseValidatorsService, private i18n: I18n @@ -52,22 +52,19 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI } async banUser () { - const moderationComment: string = this.form.value['moderationComment'] + const moderationComment: string = this.form.value[ 'moderationComment' ] this.videoAbuseService.updateVideoAbuse(this.abuseToComment, { moderationComment }) - .subscribe( - () => { - this.notificationsService.success( - this.i18n('Success'), - this.i18n('Comment updated.') - ) + .subscribe( + () => { + this.notifier.success(this.i18n('Comment updated.')) - this.commentUpdated.emit(moderationComment) - this.hideModerationCommentModal() - }, + this.commentUpdated.emit(moderationComment) + this.hideModerationCommentModal() + }, - err => this.notificationsService.error(this.i18n('Error'), err.message) - ) + err => this.notifier.error(err.message) + ) } } diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index 7a219c846..f64234b74 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ViewChild } from '@angular/core' import { Account } from '../../../shared/account/account.model' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { SortMeta } from 'primeng/components/common/sortmeta' import { VideoAbuse, VideoAbuseState } from '../../../../../../shared' import { RestPagination, RestTable, VideoAbuseService } from '../../../shared' @@ -27,7 +27,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { videoAbuseActions: DropdownAction[] = [] constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private videoAbuseService: VideoAbuseService, private confirmService: ConfirmService, private i18n: I18n @@ -90,14 +90,11 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { this.videoAbuseService.removeVideoAbuse(videoAbuse).subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), - this.i18n('Abuse deleted.') - ) + this.notifier.success(this.i18n('Abuse deleted.')) this.loadData() }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } @@ -106,7 +103,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { .subscribe( () => this.loadData(), - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } @@ -119,7 +116,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { this.totalRecords = resultList.total }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } } diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts index e491edaca..a02e84f67 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core' import { SortMeta } from 'primeng/components/common/sortmeta' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { ConfirmService } from '../../../core' import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared' import { VideoBlacklist } from '../../../../../../shared' @@ -23,7 +23,7 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { videoBlacklistActions: DropdownAction[] = [] constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private confirmService: ConfirmService, private videoBlacklistService: VideoBlacklistService, private i18n: I18n @@ -56,14 +56,11 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { this.videoBlacklistService.removeVideoFromBlacklist(entry.video.id).subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), - this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name }) - ) + this.notifier.success(this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name })) this.loadData() }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } @@ -75,7 +72,7 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { this.totalRecords = resultList.total }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } } diff --git a/client/src/app/+admin/users/user-edit/user-create.component.ts b/client/src/app/+admin/users/user-edit/user-create.component.ts index dd8e4efd5..137ecfcbd 100644 --- a/client/src/app/+admin/users/user-edit/user-create.component.ts +++ b/client/src/app/+admin/users/user-edit/user-create.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core' import { Router } from '@angular/router' -import { NotificationsService } from 'angular2-notifications' -import { ServerService } from '../../../core' +import { Notifier, ServerService } from '@app/core' import { UserCreate, UserRole } from '../../../../../../shared' import { UserEdit } from './user-edit' import { I18n } from '@ngx-translate/i18n-polyfill' @@ -24,7 +23,7 @@ export class UserCreateComponent extends UserEdit implements OnInit { protected configService: ConfigService, private userValidatorsService: UserValidatorsService, private router: Router, - private notificationsService: NotificationsService, + private notifier: Notifier, private userService: UserService, private i18n: I18n ) { @@ -60,10 +59,7 @@ export class UserCreateComponent extends UserEdit implements OnInit { this.userService.addUser(userCreate).subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), - this.i18n('User {{username}} created.', { username: userCreate.username }) - ) + this.notifier.success(this.i18n('User {{username}} created.', { username: userCreate.username })) this.router.navigate([ '/admin/users/list' ]) }, diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts index cd3885a99..61e641823 100644 --- a/client/src/app/+admin/users/user-edit/user-update.component.ts +++ b/client/src/app/+admin/users/user-edit/user-update.component.ts @@ -1,7 +1,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { Subscription } from 'rxjs' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { ServerService } from '../../../core' import { UserEdit } from './user-edit' import { User, UserUpdate } from '../../../../../../shared' @@ -30,7 +30,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { private userValidatorsService: UserValidatorsService, private route: ActivatedRoute, private router: Router, - private notificationsService: NotificationsService, + private notifier: Notifier, private userService: UserService, private i18n: I18n ) { @@ -73,10 +73,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { this.userService.updateUser(this.userId, userUpdate).subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), - this.i18n('User {{username}} updated.', { username: this.username }) - ) + this.notifier.success(this.i18n('User {{username}} updated.', { username: this.username })) this.router.navigate([ '/admin/users/list' ]) }, diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index fb085c133..66ab796f9 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, ViewChild } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { SortMeta } from 'primeng/components/common/sortmeta' import { ConfirmService, ServerService } from '../../../core' import { RestPagination, RestTable, UserService } from '../../../shared' @@ -26,7 +26,7 @@ export class UserListComponent extends RestTable implements OnInit { bulkUserActions: DropdownAction[] = [] constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private confirmService: ConfirmService, private serverService: ServerService, private userService: UserService, @@ -68,7 +68,7 @@ export class UserListComponent extends RestTable implements OnInit { openBanUserModal (users: User[]) { for (const user of users) { if (user.username === 'root') { - this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot ban root.')) + this.notifier.error(this.i18n('You cannot ban root.')) return } } @@ -91,18 +91,18 @@ export class UserListComponent extends RestTable implements OnInit { () => { const message = this.i18n('{{num}} users unbanned.', { num: users.length }) - this.notificationsService.success(this.i18n('Success'), message) + this.notifier.success(message) this.loadData() }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } async removeUsers (users: User[]) { for (const user of users) { if (user.username === 'root') { - this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot delete root.')) + this.notifier.error(this.i18n('You cannot delete root.')) return } } @@ -113,28 +113,22 @@ export class UserListComponent extends RestTable implements OnInit { this.userService.removeUser(users).subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), - this.i18n('{{num}} users deleted.', { num: users.length }) - ) + this.notifier.success(this.i18n('{{num}} users deleted.', { num: users.length })) this.loadData() }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } async setEmailsAsVerified (users: User[]) { this.userService.updateUsers(users, { emailVerified: true }).subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), - this.i18n('{{num}} users email set as verified.', { num: users.length }) - ) + this.notifier.success(this.i18n('{{num}} users email set as verified.', { num: users.length })) this.loadData() }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } @@ -146,13 +140,13 @@ export class UserListComponent extends RestTable implements OnInit { this.selectedUsers = [] this.userService.getUsers(this.pagination, this.sort, this.search) - .subscribe( - resultList => { - this.users = resultList.data - this.totalRecords = resultList.total - }, - - err => this.notificationsService.error(this.i18n('Error'), err.message) - ) + .subscribe( + resultList => { + this.users = resultList.data + this.totalRecords = resultList.total + }, + + err => this.notifier.error(err.message) + ) } } -- cgit v1.2.3 From 4707f410ae44b55e17e1758693dd21cff03b7ef1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Dec 2018 11:18:29 +0100 Subject: Fix notification with large message --- .../moderation/video-abuse-list/video-abuse-list.component.html | 4 ++-- .../video-blacklist-list/video-blacklist-list.component.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html index 0374b70ef..e862d5162 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html @@ -41,7 +41,7 @@ - + @@ -62,4 +62,4 @@ - \ No newline at end of file + diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html index ff4543b97..7cef787d2 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html @@ -30,7 +30,7 @@ {{ videoBlacklist.createdAt }} - + -- cgit v1.2.3 From 3866f1a02f73665541468fbadcc3cd2cc459aef2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 10 Jan 2019 09:58:08 +0100 Subject: Add contact form checkbox in admin form --- .../edit-custom-config.component.html | 495 +++++++++++---------- .../edit-custom-config.component.ts | 203 +++------ 2 files changed, 321 insertions(+), 377 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index 6ece7e8bc..52eb00d93 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html @@ -7,169 +7,169 @@
Instance
-
- - -
- {{ formErrors.instanceName }} + +
+ + +
{{ formErrors.instance.name }}
-
-
- - -
- {{ formErrors.instanceShortDescription }} +
+ + +
{{ formErrors.instance.shortDescription }}
-
-
- - -
- {{ formErrors.instanceDescription }} +
+ + +
{{ formErrors.instance.description }}
-
-
- - -
- {{ formErrors.instanceTerms }} +
+ + +
{{ formErrors.instance.terms }}
-
-
- -
- +
+ +
+ +
+
{{ formErrors.instance.defaultClientRoute }}
-
- {{ formErrors.instanceDefaultClientRoute }} + +
+ + + +
+ +
+
{{ formErrors.instance.defaultNSFWPolicy }}
-
+ -
- - +
Signup
-
- + +
+
-
- {{ formErrors.instanceDefaultNSFWPolicy }} + +
+
-
-
Signup
+
+ + +
{{ formErrors.signup.limit }}
+
+
-
- -
+
Users
-
- -
+ +
+ +
+ +
+
{{ formErrors.user.videoQuota }}
+
-
- - -
- {{ formErrors.signupLimit }} +
+ +
+ +
+
{{ formErrors.user.videoQuotaDaily }}
-
+
Import
-
- -
+ + -
- -
+
+ +
+ +
+ +
+ +
+
Administrator
-
+
-
- {{ formErrors.adminEmail }} -
+
{{ formErrors.admin.email }}
-
Users
- -
- -
- -
-
- {{ formErrors.userVideoQuota }} -
+
+
-
- -
- -
-
- {{ formErrors.userVideoQuotaDaily }} -
-
@@ -177,30 +177,35 @@
Twitter
-
- - - -
- {{ formErrors.servicesTwitterUsername }} -
-
+ + + +
+ + + +
{{ formErrors.services.twitter.username }}
+
+ +
+ +
+ +
+
-
- -
@@ -209,45 +214,48 @@
Transcoding
-
- -
- - - +
-
- -
- + + +
+
-
- {{ formErrors.transcodingThreads }} + +
+ +
+ +
+
{{ formErrors.transcoding.threads }}
-
-
- -
- + +
+ +
+
+ +
+
Cache @@ -258,74 +266,73 @@ >
-
- - -
- {{ formErrors.cachePreviewsSize }} + +
+ + +
{{ formErrors.cache.previews.size }}
-
-
- - -
- {{ formErrors.cacheCaptionsSize }} +
+ + +
{{ formErrors.cache.captions.size }}
-
+
Customizations
-
- - - -
- {{ formErrors.customizationJavascript }} -
-
+ + +
+ + + +
{{ formErrors.instance.customizations.javascript }}
+
+ +
+ + + +
{{ formErrors.instance.customizations.css }}
+
+
+
-
- - - -
- {{ formErrors.customizationCSS }} -
-
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index ee877ee31..654a076b0 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -18,9 +18,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { resolutions: string[] = [] transcodingThreadOptions: { label: string, value: number }[] = [] - private oldCustomJavascript: string - private oldCustomCSS: string - constructor ( protected formValidatorService: FormValidatorService, private customConfigValidatorsService: CustomConfigValidatorsService, @@ -58,41 +55,78 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } getResolutionKey (resolution: string) { - return 'transcodingResolution' + resolution + return 'transcoding.resolutions.' + resolution } ngOnInit () { - const formGroupData: { [key: string]: any } = { - instanceName: this.customConfigValidatorsService.INSTANCE_NAME, - instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION, - instanceDescription: null, - instanceTerms: null, - instanceDefaultClientRoute: null, - instanceDefaultNSFWPolicy: null, - servicesTwitterUsername: this.customConfigValidatorsService.SERVICES_TWITTER_USERNAME, - servicesTwitterWhitelisted: null, - cachePreviewsSize: this.customConfigValidatorsService.CACHE_PREVIEWS_SIZE, - cacheCaptionsSize: this.customConfigValidatorsService.CACHE_CAPTIONS_SIZE, - signupEnabled: null, - signupLimit: this.customConfigValidatorsService.SIGNUP_LIMIT, - signupRequiresEmailVerification: null, - importVideosHttpEnabled: null, - importVideosTorrentEnabled: null, - adminEmail: this.customConfigValidatorsService.ADMIN_EMAIL, - userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, - userVideoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY, - transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS, - transcodingAllowAdditionalExtensions: null, - transcodingEnabled: null, - customizationJavascript: null, - customizationCSS: null + const formGroupData: { [key in keyof CustomConfig ]: any } = { + instance: { + name: this.customConfigValidatorsService.INSTANCE_NAME, + shortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION, + description: null, + terms: null, + defaultClientRoute: null, + defaultNSFWPolicy: null, + customizations: { + javascript: null, + css: null + } + }, + services: { + twitter: { + username: this.customConfigValidatorsService.SERVICES_TWITTER_USERNAME, + whitelisted: null + } + }, + cache: { + previews: { + size: this.customConfigValidatorsService.CACHE_PREVIEWS_SIZE + }, + captions: { + size: this.customConfigValidatorsService.CACHE_CAPTIONS_SIZE + } + }, + signup: { + enabled: null, + limit: this.customConfigValidatorsService.SIGNUP_LIMIT, + requiresEmailVerification: null + }, + import: { + videos: { + http: { + enabled: null + }, + torrent: { + enabled: null + } + } + }, + admin: { + email: this.customConfigValidatorsService.ADMIN_EMAIL + }, + contactForm: { + enabled: null + }, + user: { + videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA, + videoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY + }, + transcoding: { + enabled: null, + threads: this.customConfigValidatorsService.TRANSCODING_THREADS, + allowAdditionalExtensions: null, + resolutions: {} + } } - const defaultValues: BuildFormDefaultValues = {} + const defaultValues = { + transcoding: { + resolutions: {} + } + } for (const resolution of this.resolutions) { - const key = this.getResolutionKey(resolution) - defaultValues[key] = 'false' - formGroupData[key] = null + defaultValues.transcoding.resolutions[resolution] = 'false' + formGroupData.transcoding.resolutions[resolution] = null } this.buildForm(formGroupData) @@ -102,9 +136,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { res => { this.customConfig = res - this.oldCustomCSS = this.customConfig.instance.customizations.css - this.oldCustomJavascript = this.customConfig.instance.customizations.javascript - this.updateForm() // Force form validation this.forceCheck() @@ -115,78 +146,15 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } isTranscodingEnabled () { - return this.form.value['transcodingEnabled'] === true + return this.form.value['transcoding']['enabled'] === true } isSignupEnabled () { - return this.form.value['signupEnabled'] === true + return this.form.value['signup']['enabled'] === true } async formValidated () { - const data: CustomConfig = { - instance: { - name: this.form.value['instanceName'], - shortDescription: this.form.value['instanceShortDescription'], - description: this.form.value['instanceDescription'], - terms: this.form.value['instanceTerms'], - defaultClientRoute: this.form.value['instanceDefaultClientRoute'], - defaultNSFWPolicy: this.form.value['instanceDefaultNSFWPolicy'], - customizations: { - javascript: this.form.value['customizationJavascript'], - css: this.form.value['customizationCSS'] - } - }, - services: { - twitter: { - username: this.form.value['servicesTwitterUsername'], - whitelisted: this.form.value['servicesTwitterWhitelisted'] - } - }, - cache: { - previews: { - size: this.form.value['cachePreviewsSize'] - }, - captions: { - size: this.form.value['cacheCaptionsSize'] - } - }, - signup: { - enabled: this.form.value['signupEnabled'], - limit: this.form.value['signupLimit'], - requiresEmailVerification: this.form.value['signupRequiresEmailVerification'] - }, - admin: { - email: this.form.value['adminEmail'] - }, - user: { - videoQuota: this.form.value['userVideoQuota'], - videoQuotaDaily: this.form.value['userVideoQuotaDaily'] - }, - transcoding: { - enabled: this.form.value['transcodingEnabled'], - allowAdditionalExtensions: this.form.value['transcodingAllowAdditionalExtensions'], - threads: this.form.value['transcodingThreads'], - resolutions: { - '240p': this.form.value[this.getResolutionKey('240p')], - '360p': this.form.value[this.getResolutionKey('360p')], - '480p': this.form.value[this.getResolutionKey('480p')], - '720p': this.form.value[this.getResolutionKey('720p')], - '1080p': this.form.value[this.getResolutionKey('1080p')] - } - }, - import: { - videos: { - http: { - enabled: this.form.value['importVideosHttpEnabled'] - }, - torrent: { - enabled: this.form.value['importVideosTorrentEnabled'] - } - } - } - } - - this.configService.updateCustomConfig(data) + this.configService.updateCustomConfig(this.form.value) .subscribe( res => { this.customConfig = res @@ -204,38 +172,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { } private updateForm () { - const data: { [key: string]: any } = { - instanceName: this.customConfig.instance.name, - instanceShortDescription: this.customConfig.instance.shortDescription, - instanceDescription: this.customConfig.instance.description, - instanceTerms: this.customConfig.instance.terms, - instanceDefaultClientRoute: this.customConfig.instance.defaultClientRoute, - instanceDefaultNSFWPolicy: this.customConfig.instance.defaultNSFWPolicy, - servicesTwitterUsername: this.customConfig.services.twitter.username, - servicesTwitterWhitelisted: this.customConfig.services.twitter.whitelisted, - cachePreviewsSize: this.customConfig.cache.previews.size, - cacheCaptionsSize: this.customConfig.cache.captions.size, - signupEnabled: this.customConfig.signup.enabled, - signupLimit: this.customConfig.signup.limit, - signupRequiresEmailVerification: this.customConfig.signup.requiresEmailVerification, - adminEmail: this.customConfig.admin.email, - userVideoQuota: this.customConfig.user.videoQuota, - userVideoQuotaDaily: this.customConfig.user.videoQuotaDaily, - transcodingThreads: this.customConfig.transcoding.threads, - transcodingEnabled: this.customConfig.transcoding.enabled, - transcodingAllowAdditionalExtensions: this.customConfig.transcoding.allowAdditionalExtensions, - customizationJavascript: this.customConfig.instance.customizations.javascript, - customizationCSS: this.customConfig.instance.customizations.css, - importVideosHttpEnabled: this.customConfig.import.videos.http.enabled, - importVideosTorrentEnabled: this.customConfig.import.videos.torrent.enabled - } - - for (const resolution of this.resolutions) { - const key = this.getResolutionKey(resolution) - data[key] = this.customConfig.transcoding.resolutions[resolution] - } - - this.form.patchValue(data) + this.form.patchValue(this.customConfig) } } -- cgit v1.2.3 From 5abb9fbbd12e7097e348d6a38622d364b1fa47ed Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 10 Jan 2019 15:39:51 +0100 Subject: Add ability to unfederate a local video (on blacklist) --- .../video-blacklist-list/video-blacklist-list.component.html | 6 ++++-- .../video-blacklist-list/video-blacklist-list.component.ts | 6 ++++++ client/src/app/+admin/users/user-list/user-list.component.html | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html index 7cef787d2..6398af218 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html @@ -7,6 +7,7 @@ Video name Sensitive + Unfederated Date @@ -26,7 +27,8 @@ - {{ videoBlacklist.video.nsfw }} + {{ booleanToText(videoBlacklist.video.nsfw) }} + {{ booleanToText(videoBlacklist.unfederated) }} {{ videoBlacklist.createdAt }} @@ -37,7 +39,7 @@ - + Blacklist reason: {{ videoBlacklist.reason }} diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts index a02e84f67..6c6f17f0c 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts @@ -46,6 +46,12 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { return Video.buildClientUrl(videoBlacklist.video.uuid) } + booleanToText (value: boolean) { + if (value === true) return this.i18n('yes') + + return this.i18n('no') + } + async removeVideoFromBlacklist (entry: VideoBlacklist) { const confirmMessage = this.i18n( 'Do you really want to remove this video from the blacklist? It will be available again in the videos list.' diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index 556ab3c5d..8c03a924b 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html @@ -65,7 +65,9 @@ (banned) + {{ user.email }} + ? {{ user.email }} @@ -76,6 +78,7 @@ + {{ user.videoQuotaUsed }} / {{ user.videoQuota }} {{ user.roleLabel }} {{ user.createdAt }} -- cgit v1.2.3 From 1506307f2f903ce0f80155072a33345c702b7c76 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Jan 2019 16:48:38 +0100 Subject: Increase abuse length to 3000 And correctly handle new lines --- client/src/app/+admin/moderation/moderation.component.scss | 1 + .../moderation/video-abuse-list/video-abuse-list.component.html | 4 ++-- .../moderation/video-abuse-list/video-abuse-list.component.ts | 8 +++++++- .../video-blacklist-list/video-blacklist-list.component.html | 2 +- .../video-blacklist-list/video-blacklist-list.component.ts | 6 ++++++ 5 files changed, 17 insertions(+), 4 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/moderation/moderation.component.scss b/client/src/app/+admin/moderation/moderation.component.scss index 02ccfc8ca..13b019c5b 100644 --- a/client/src/app/+admin/moderation/moderation.component.scss +++ b/client/src/app/+admin/moderation/moderation.component.scss @@ -10,6 +10,7 @@ font-weight: $font-semibold; min-width: 200px; display: inline-block; + vertical-align: top; } .moderation-expanded-text { diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html index e862d5162..05b549de6 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html @@ -51,11 +51,11 @@
Reason: - {{ videoAbuse.reason }} +
Moderation comment: - {{ videoAbuse.moderationComment }} +
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index f64234b74..00c871659 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts @@ -9,6 +9,7 @@ import { DropdownAction } from '../../../shared/buttons/action-dropdown.componen import { ConfirmService } from '../../../core/index' import { ModerationCommentModalComponent } from './moderation-comment-modal.component' import { Video } from '../../../shared/video/video.model' +import { MarkdownService } from '@app/shared/renderer' @Component({ selector: 'my-video-abuse-list', @@ -30,7 +31,8 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { private notifier: Notifier, private videoAbuseService: VideoAbuseService, private confirmService: ConfirmService, - private i18n: I18n + private i18n: I18n, + private markdownRenderer: MarkdownService ) { super() @@ -108,6 +110,10 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { } + toHtml (text: string) { + return this.markdownRenderer.textMarkdownToHTML(text) + } + protected loadData () { return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort) .subscribe( diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html index 6398af218..247f441c1 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html @@ -41,7 +41,7 @@ Blacklist reason: - {{ videoBlacklist.reason }} + diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts index 6c6f17f0c..b27bbbfef 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts @@ -7,6 +7,7 @@ import { VideoBlacklist } from '../../../../../../shared' import { I18n } from '@ngx-translate/i18n-polyfill' import { DropdownAction } from '../../../shared/buttons/action-dropdown.component' import { Video } from '../../../shared/video/video.model' +import { MarkdownService } from '@app/shared/renderer' @Component({ selector: 'my-video-blacklist-list', @@ -26,6 +27,7 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { private notifier: Notifier, private confirmService: ConfirmService, private videoBlacklistService: VideoBlacklistService, + private markdownRenderer: MarkdownService, private i18n: I18n ) { super() @@ -52,6 +54,10 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { return this.i18n('no') } + toHtml (text: string) { + return this.markdownRenderer.textMarkdownToHTML(text) + } + async removeVideoFromBlacklist (entry: VideoBlacklist) { const confirmMessage = this.i18n( 'Do you really want to remove this video from the blacklist? It will be available again in the videos list.' -- cgit v1.2.3 From 3195cd1c118f5e020ab7e635d5a3dcdad2108b1a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 Jan 2019 09:25:26 +0100 Subject: Fix notification z-index on modals --- .../video-abuse-list/moderation-comment-modal.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html index 3a8424f68..952235c55 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html +++ b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html @@ -14,7 +14,7 @@
-
+
This comment can only be seen by you or the other moderators.
@@ -29,4 +29,4 @@
- \ No newline at end of file + -- cgit v1.2.3 From 457bb213b273a9b206cc5654eb085cede4e916ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 16 Jan 2019 16:05:40 +0100 Subject: Refactor how we use icons Inject them in an angular component so we can easily change their color --- .../video-abuse-list/moderation-comment-modal.component.html | 5 +++-- .../video-abuse-list/moderation-comment-modal.component.ts | 4 ++-- client/src/app/+admin/users/user-list/user-list.component.html | 2 +- client/src/app/+admin/users/user-list/user-list.component.scss | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html index 952235c55..303a788d2 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html +++ b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.html @@ -1,7 +1,8 @@
- Cancel + Cancel this.notifier.error(err.message) diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index 8c03a924b..69a4616a3 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html @@ -2,7 +2,7 @@
Users list
- + Create user
diff --git a/client/src/app/+admin/users/user-list/user-list.component.scss b/client/src/app/+admin/users/user-list/user-list.component.scss index f235769f0..5274be01c 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.scss +++ b/client/src/app/+admin/users/user-list/user-list.component.scss @@ -2,7 +2,7 @@ @import '_mixins'; .add-button { - @include create-button('../../../../assets/images/global/add.svg'); + @include create-button; } tr.banned { @@ -23,4 +23,4 @@ tr.banned { input { @include peertube-input-text(250px); } -} \ No newline at end of file +} -- cgit v1.2.3 From 092092969633bbcf6d4891a083ea497a7d5c3154 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 29 Jan 2019 08:37:25 +0100 Subject: Add hls support on server --- client/src/app/+admin/users/user-edit/user-edit.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 0b3511e8e..021b1feb4 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -22,7 +22,9 @@ export abstract class UserEdit extends FormReactive { } computeQuotaWithTranscoding () { - const resolutions = this.serverService.getConfig().transcoding.enabledResolutions + const transcodingConfig = this.serverService.getConfig().transcoding + + const resolutions = transcodingConfig.enabledResolutions const higherResolution = VideoResolution.H_1080P let multiplier = 0 @@ -30,6 +32,8 @@ export abstract class UserEdit extends FormReactive { multiplier += resolution / higherResolution } + if (transcodingConfig.hls.enabled) multiplier *= 2 + return multiplier * parseInt(this.form.value['videoQuota'], 10) } -- cgit v1.2.3 From 328c78bc4a570a9aceaaa1a2124bacd4a0e8d295 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sat, 6 Oct 2018 13:54:00 +0200 Subject: allow administration to change/reset a user's password --- client/src/app/+admin/admin.module.ts | 3 +- client/src/app/+admin/users/user-edit/index.ts | 1 + .../users/user-edit/user-edit.component.html | 10 +++ .../users/user-edit/user-edit.component.scss | 9 +- .../users/user-edit/user-password.component.html | 25 ++++++ .../users/user-edit/user-password.component.scss | 21 +++++ .../users/user-edit/user-password.component.ts | 100 +++++++++++++++++++++ .../users/user-edit/user-update.component.ts | 24 ++++- client/src/app/+admin/users/users.routes.ts | 3 +- 9 files changed, 192 insertions(+), 4 deletions(-) create mode 100644 client/src/app/+admin/users/user-edit/user-password.component.html create mode 100644 client/src/app/+admin/users/user-edit/user-password.component.scss create mode 100644 client/src/app/+admin/users/user-edit/user-password.component.ts (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts index c06ae1d60..f7f347105 100644 --- a/client/src/app/+admin/admin.module.ts +++ b/client/src/app/+admin/admin.module.ts @@ -10,7 +10,7 @@ import { FollowingListComponent } from './follows/following-list/following-list. import { JobsComponent } from './jobs/job.component' import { JobsListComponent } from './jobs/jobs-list/jobs-list.component' import { JobService } from './jobs/shared/job.service' -import { UserCreateComponent, UserListComponent, UsersComponent, UserUpdateComponent } from './users' +import { UserCreateComponent, UserListComponent, UsersComponent, UserUpdateComponent, UserPasswordComponent } from './users' import { ModerationCommentModalComponent, VideoAbuseListComponent, VideoBlacklistListComponent } from './moderation' import { ModerationComponent } from '@app/+admin/moderation/moderation.component' import { RedundancyCheckboxComponent } from '@app/+admin/follows/shared/redundancy-checkbox.component' @@ -36,6 +36,7 @@ import { InstanceAccountBlocklistComponent, InstanceServerBlocklistComponent } f UsersComponent, UserCreateComponent, UserUpdateComponent, + UserPasswordComponent, UserListComponent, ModerationComponent, diff --git a/client/src/app/+admin/users/user-edit/index.ts b/client/src/app/+admin/users/user-edit/index.ts index fd80a02e0..ec734ef92 100644 --- a/client/src/app/+admin/users/user-edit/index.ts +++ b/client/src/app/+admin/users/user-edit/index.ts @@ -1,2 +1,3 @@ export * from './user-create.component' export * from './user-update.component' +export * from './user-password.component' diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.html b/client/src/app/+admin/users/user-edit/user-edit.component.html index 56cf7d17d..cbc06c157 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.component.html +++ b/client/src/app/+admin/users/user-edit/user-edit.component.html @@ -81,3 +81,13 @@ + +
+ + +

Send a link to reset the password by mail to the user.

+ + +

Manually set the user password

+ +
\ No newline at end of file diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.scss b/client/src/app/+admin/users/user-edit/user-edit.component.scss index 6675f65cc..2b4aae83c 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.component.scss +++ b/client/src/app/+admin/users/user-edit/user-edit.component.scss @@ -14,7 +14,7 @@ input:not([type=submit]) { @include peertube-select-container(340px); } -input[type=submit] { +input[type=submit], button { @include peertube-button; @include orange-button; @@ -25,3 +25,10 @@ input[type=submit] { margin-top: 5px; font-size: 11px; } + +.account-title { + @include in-content-small-title; + + margin-top: 55px; + margin-bottom: 30px; +} diff --git a/client/src/app/+admin/users/user-edit/user-password.component.html b/client/src/app/+admin/users/user-edit/user-password.component.html new file mode 100644 index 000000000..ee7d8dff5 --- /dev/null +++ b/client/src/app/+admin/users/user-edit/user-password.component.html @@ -0,0 +1,25 @@ +
+
+ +
+
+
+ +
+
+ +
+ +
+
+
+ {{ formErrors.password }} +
+
+ + +
\ No newline at end of file diff --git a/client/src/app/+admin/users/user-edit/user-password.component.scss b/client/src/app/+admin/users/user-edit/user-password.component.scss new file mode 100644 index 000000000..9185e787c --- /dev/null +++ b/client/src/app/+admin/users/user-edit/user-password.component.scss @@ -0,0 +1,21 @@ +@import '_variables'; +@import '_mixins'; + +input:not([type=submit]):not([type=checkbox]) { + @include peertube-input-text(340px); + display: block; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-right: none; +} + +input[type=submit] { + @include peertube-button; + @include orange-button; + + margin-top: 10px; +} + +.input-group-append { + height: 30px; +} diff --git a/client/src/app/+admin/users/user-edit/user-password.component.ts b/client/src/app/+admin/users/user-edit/user-password.component.ts new file mode 100644 index 000000000..1f9ccb4e8 --- /dev/null +++ b/client/src/app/+admin/users/user-edit/user-password.component.ts @@ -0,0 +1,100 @@ +import { Component, OnDestroy, OnInit, Input } from '@angular/core' +import { ActivatedRoute, Router } from '@angular/router' +import { Subscription } from 'rxjs' +import * as generator from 'generate-password-browser' +import { NotificationsService } from 'angular2-notifications' +import { UserService } from '@app/shared/users/user.service' +import { ServerService } from '../../../core' +import { User, UserUpdate } from '../../../../../../shared' +import { I18n } from '@ngx-translate/i18n-polyfill' +import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' +import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' +import { ConfigService } from '@app/+admin/config/shared/config.service' +import { FormReactive } from '../../../shared' + +@Component({ + selector: 'my-user-password', + templateUrl: './user-password.component.html', + styleUrls: [ './user-password.component.scss' ] +}) +export class UserPasswordComponent extends FormReactive implements OnInit, OnDestroy { + error: string + userId: number + username: string + showPassword = false + + private paramsSub: Subscription + + constructor ( + protected formValidatorService: FormValidatorService, + protected serverService: ServerService, + protected configService: ConfigService, + private userValidatorsService: UserValidatorsService, + private route: ActivatedRoute, + private router: Router, + private notificationsService: NotificationsService, + private userService: UserService, + private i18n: I18n + ) { + super() + } + + ngOnInit () { + this.buildForm({ + password: this.userValidatorsService.USER_PASSWORD + }) + + this.paramsSub = this.route.params.subscribe(routeParams => { + const userId = routeParams['id'] + this.userService.getUser(userId).subscribe( + user => this.onUserFetched(user), + + err => this.error = err.message + ) + }) + } + + ngOnDestroy () { + this.paramsSub.unsubscribe() + } + + formValidated () { + this.error = undefined + + const userUpdate: UserUpdate = this.form.value + + this.userService.updateUser(this.userId, userUpdate).subscribe( + () => { + this.notificationsService.success( + this.i18n('Success'), + this.i18n('Password changed for user {{username}}.', { username: this.username }) + ) + }, + + err => this.error = err.message + ) + } + + generatePassword () { + this.form.patchValue({ + password: generator.generate({ + length: 16, + excludeSimilarCharacters: true, + strict: true + }) + }) + } + + togglePasswordVisibility () { + this.showPassword = !this.showPassword + } + + getFormButtonTitle () { + return this.i18n('Update user password') + } + + private onUserFetched (userJson: User) { + this.userId = userJson.id + this.username = userJson.username + } +} diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts index 61e641823..cb74897d0 100644 --- a/client/src/app/+admin/users/user-edit/user-update.component.ts +++ b/client/src/app/+admin/users/user-edit/user-update.component.ts @@ -1,4 +1,4 @@ -import { Component, OnDestroy, OnInit } from '@angular/core' +import { Component, OnDestroy, OnInit, Input } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { Subscription } from 'rxjs' import { Notifier } from '@app/core' @@ -19,9 +19,12 @@ import { UserService } from '@app/shared' export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { error: string userId: number + userEmail: string username: string + isAdministration = false private paramsSub: Subscription + private isAdministrationSub: Subscription constructor ( protected formValidatorService: FormValidatorService, @@ -56,10 +59,15 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { err => this.error = err.message ) }) + + this.isAdministrationSub = this.route.data.subscribe(data => { + if (data.isAdministration) this.isAdministration = data.isAdministration + }) } ngOnDestroy () { this.paramsSub.unsubscribe() + this.isAdministrationSub.unsubscribe() } formValidated () { @@ -89,9 +97,23 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { return this.i18n('Update user') } + resetPassword () { + this.userService.askResetPassword(this.userEmail).subscribe( + () => { + this.notificationsService.success( + this.i18n('Success'), + this.i18n('An email asking for password reset has been sent to {{username}}.', { username: this.username }) + ) + }, + + err => this.error = err.message + ) + } + private onUserFetched (userJson: User) { this.userId = userJson.id this.username = userJson.username + this.userEmail = userJson.email this.form.patchValue({ email: userJson.email, diff --git a/client/src/app/+admin/users/users.routes.ts b/client/src/app/+admin/users/users.routes.ts index 8b3791bd3..460ebd89e 100644 --- a/client/src/app/+admin/users/users.routes.ts +++ b/client/src/app/+admin/users/users.routes.ts @@ -44,7 +44,8 @@ export const UsersRoutes: Routes = [ data: { meta: { title: 'Update a user' - } + }, + isAdministration: true } } ] -- cgit v1.2.3 From a3342ce250936c30dc6df7563f4e984c172f61c1 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Mon, 8 Oct 2018 15:56:56 +0200 Subject: remove isAdministration --- client/src/app/+admin/users/user-edit/user-edit.component.html | 10 ++++------ .../app/+admin/users/user-edit/user-password.component.html | 4 ++-- client/src/app/+admin/users/user-edit/user-update.component.ts | 7 ------- client/src/app/+admin/users/users.routes.ts | 3 +-- 4 files changed, 7 insertions(+), 17 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.html b/client/src/app/+admin/users/user-edit/user-edit.component.html index cbc06c157..b06c91ff3 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.component.html +++ b/client/src/app/+admin/users/user-edit/user-edit.component.html @@ -82,12 +82,10 @@ -
-

Send a link to reset the password by mail to the user.

- +

Send a link to reset the password by mail to the user.

+ -

Manually set the user password

- -
\ No newline at end of file +

Manually set the user password

+ diff --git a/client/src/app/+admin/users/user-edit/user-password.component.html b/client/src/app/+admin/users/user-edit/user-password.component.html index ee7d8dff5..267422bdd 100644 --- a/client/src/app/+admin/users/user-edit/user-password.component.html +++ b/client/src/app/+admin/users/user-edit/user-password.component.html @@ -8,7 +8,7 @@
@@ -22,4 +22,4 @@
- \ No newline at end of file + diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts index cb74897d0..4e4002a73 100644 --- a/client/src/app/+admin/users/user-edit/user-update.component.ts +++ b/client/src/app/+admin/users/user-edit/user-update.component.ts @@ -21,10 +21,8 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { userId: number userEmail: string username: string - isAdministration = false private paramsSub: Subscription - private isAdministrationSub: Subscription constructor ( protected formValidatorService: FormValidatorService, @@ -59,15 +57,10 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { err => this.error = err.message ) }) - - this.isAdministrationSub = this.route.data.subscribe(data => { - if (data.isAdministration) this.isAdministration = data.isAdministration - }) } ngOnDestroy () { this.paramsSub.unsubscribe() - this.isAdministrationSub.unsubscribe() } formValidated () { diff --git a/client/src/app/+admin/users/users.routes.ts b/client/src/app/+admin/users/users.routes.ts index 460ebd89e..8b3791bd3 100644 --- a/client/src/app/+admin/users/users.routes.ts +++ b/client/src/app/+admin/users/users.routes.ts @@ -44,8 +44,7 @@ export const UsersRoutes: Routes = [ data: { meta: { title: 'Update a user' - }, - isAdministration: true + } } } ] -- cgit v1.2.3 From 2c2baef6f30625794cf1f4f72c184527a4d82562 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Mon, 8 Oct 2018 21:05:57 +0200 Subject: move user-password to Input decorator --- .../src/app/+admin/users/user-edit/user-edit.component.html | 2 +- .../app/+admin/users/user-edit/user-password.component.ts | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.html b/client/src/app/+admin/users/user-edit/user-edit.component.html index b06c91ff3..6944ec435 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.component.html +++ b/client/src/app/+admin/users/user-edit/user-edit.component.html @@ -88,4 +88,4 @@

Manually set the user password

- + diff --git a/client/src/app/+admin/users/user-edit/user-password.component.ts b/client/src/app/+admin/users/user-edit/user-password.component.ts index 1f9ccb4e8..99c4c8a59 100644 --- a/client/src/app/+admin/users/user-edit/user-password.component.ts +++ b/client/src/app/+admin/users/user-edit/user-password.component.ts @@ -19,10 +19,11 @@ import { FormReactive } from '../../../shared' }) export class UserPasswordComponent extends FormReactive implements OnInit, OnDestroy { error: string - userId: number username: string showPassword = false + @Input() userId: number + private paramsSub: Subscription constructor ( @@ -43,15 +44,6 @@ export class UserPasswordComponent extends FormReactive implements OnInit, OnDes this.buildForm({ password: this.userValidatorsService.USER_PASSWORD }) - - this.paramsSub = this.route.params.subscribe(routeParams => { - const userId = routeParams['id'] - this.userService.getUser(userId).subscribe( - user => this.onUserFetched(user), - - err => this.error = err.message - ) - }) } ngOnDestroy () { -- cgit v1.2.3 From 67b1d3fed765278bdc876cce393ef56d56942df0 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sat, 8 Dec 2018 15:37:36 +0100 Subject: cleanup and remove paramSubs --- client/src/app/+admin/users/user-edit/user-edit.component.html | 10 ++++++---- .../app/+admin/users/user-edit/user-password.component.html | 4 ++-- .../src/app/+admin/users/user-edit/user-password.component.ts | 5 +---- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.html b/client/src/app/+admin/users/user-edit/user-edit.component.html index 6944ec435..3ce246771 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.component.html +++ b/client/src/app/+admin/users/user-edit/user-edit.component.html @@ -82,10 +82,12 @@ +
-

Send a link to reset the password by mail to the user.

- +

Send a link to reset the password by mail to the user.

+ -

Manually set the user password

- +

Manually set the user password

+ +
\ No newline at end of file diff --git a/client/src/app/+admin/users/user-edit/user-password.component.html b/client/src/app/+admin/users/user-edit/user-password.component.html index 267422bdd..822e4688e 100644 --- a/client/src/app/+admin/users/user-edit/user-password.component.html +++ b/client/src/app/+admin/users/user-edit/user-password.component.html @@ -1,4 +1,4 @@ -
+
@@ -12,7 +12,7 @@ formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }" >
-
diff --git a/client/src/app/+admin/users/user-edit/user-password.component.ts b/client/src/app/+admin/users/user-edit/user-password.component.ts index 99c4c8a59..30cd21ccd 100644 --- a/client/src/app/+admin/users/user-edit/user-password.component.ts +++ b/client/src/app/+admin/users/user-edit/user-password.component.ts @@ -1,6 +1,5 @@ import { Component, OnDestroy, OnInit, Input } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import { Subscription } from 'rxjs' import * as generator from 'generate-password-browser' import { NotificationsService } from 'angular2-notifications' import { UserService } from '@app/shared/users/user.service' @@ -24,8 +23,6 @@ export class UserPasswordComponent extends FormReactive implements OnInit, OnDes @Input() userId: number - private paramsSub: Subscription - constructor ( protected formValidatorService: FormValidatorService, protected serverService: ServerService, @@ -47,7 +44,7 @@ export class UserPasswordComponent extends FormReactive implements OnInit, OnDes } ngOnDestroy () { - this.paramsSub.unsubscribe() + // } formValidated () { -- cgit v1.2.3 From b426edd4854adc6e65844d8c54b8998e792b5778 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 11 Feb 2019 09:30:29 +0100 Subject: Cleanup reset user password by admin And add some tests --- .../users/user-edit/user-edit.component.html | 16 ++++++---- .../users/user-edit/user-edit.component.scss | 13 ++++++++ client/src/app/+admin/users/user-edit/user-edit.ts | 5 ++++ .../users/user-edit/user-password.component.html | 16 ++++------ .../users/user-edit/user-password.component.scss | 1 + .../users/user-edit/user-password.component.ts | 35 ++++------------------ .../users/user-edit/user-update.component.ts | 5 ++-- 7 files changed, 42 insertions(+), 49 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.html b/client/src/app/+admin/users/user-edit/user-edit.component.html index 3ce246771..c6566da24 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.component.html +++ b/client/src/app/+admin/users/user-edit/user-edit.component.html @@ -82,12 +82,16 @@ -
+
-

Send a link to reset the password by mail to the user.

- +
+ + +
-

Manually set the user password

- -
\ No newline at end of file +
+ + +
+
diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.scss b/client/src/app/+admin/users/user-edit/user-edit.component.scss index 2b4aae83c..c1cc4ca45 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.component.scss +++ b/client/src/app/+admin/users/user-edit/user-edit.component.scss @@ -32,3 +32,16 @@ input[type=submit], button { margin-top: 55px; margin-bottom: 30px; } + +.danger-zone { + .reset-password-email { + margin-bottom: 30px; + padding-bottom: 30px; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + + button { + display: block; + margin-top: 0; + } + } +} diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts index 021b1feb4..649b35b0c 100644 --- a/client/src/app/+admin/users/user-edit/user-edit.ts +++ b/client/src/app/+admin/users/user-edit/user-edit.ts @@ -8,6 +8,7 @@ export abstract class UserEdit extends FormReactive { videoQuotaDailyOptions: { value: string, label: string }[] = [] roles = Object.keys(USER_ROLE_LABELS).map(key => ({ value: key.toString(), label: USER_ROLE_LABELS[key] })) username: string + userId: number protected abstract serverService: ServerService protected abstract configService: ConfigService @@ -37,6 +38,10 @@ export abstract class UserEdit extends FormReactive { return multiplier * parseInt(this.form.value['videoQuota'], 10) } + resetPassword () { + return + } + protected buildQuotaOptions () { // These are used by a HTML select, so convert key into strings this.videoQuotaOptions = this.configService diff --git a/client/src/app/+admin/users/user-edit/user-password.component.html b/client/src/app/+admin/users/user-edit/user-password.component.html index 822e4688e..a1e1f6216 100644 --- a/client/src/app/+admin/users/user-edit/user-password.component.html +++ b/client/src/app/+admin/users/user-edit/user-password.component.html @@ -1,19 +1,15 @@
-
-
-
- -
-
- +
- +
diff --git a/client/src/app/+admin/users/user-edit/user-password.component.scss b/client/src/app/+admin/users/user-edit/user-password.component.scss index 9185e787c..217d585af 100644 --- a/client/src/app/+admin/users/user-edit/user-password.component.scss +++ b/client/src/app/+admin/users/user-edit/user-password.component.scss @@ -3,6 +3,7 @@ input:not([type=submit]):not([type=checkbox]) { @include peertube-input-text(340px); + display: block; border-top-right-radius: 0; border-bottom-right-radius: 0; diff --git a/client/src/app/+admin/users/user-edit/user-password.component.ts b/client/src/app/+admin/users/user-edit/user-password.component.ts index 30cd21ccd..5b3040440 100644 --- a/client/src/app/+admin/users/user-edit/user-password.component.ts +++ b/client/src/app/+admin/users/user-edit/user-password.component.ts @@ -1,14 +1,11 @@ -import { Component, OnDestroy, OnInit, Input } from '@angular/core' +import { Component, Input, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' -import * as generator from 'generate-password-browser' -import { NotificationsService } from 'angular2-notifications' import { UserService } from '@app/shared/users/user.service' -import { ServerService } from '../../../core' +import { Notifier } from '../../../core' import { User, UserUpdate } from '../../../../../../shared' import { I18n } from '@ngx-translate/i18n-polyfill' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' -import { ConfigService } from '@app/+admin/config/shared/config.service' import { FormReactive } from '../../../shared' @Component({ @@ -16,7 +13,7 @@ import { FormReactive } from '../../../shared' templateUrl: './user-password.component.html', styleUrls: [ './user-password.component.scss' ] }) -export class UserPasswordComponent extends FormReactive implements OnInit, OnDestroy { +export class UserPasswordComponent extends FormReactive implements OnInit { error: string username: string showPassword = false @@ -25,12 +22,10 @@ export class UserPasswordComponent extends FormReactive implements OnInit, OnDes constructor ( protected formValidatorService: FormValidatorService, - protected serverService: ServerService, - protected configService: ConfigService, private userValidatorsService: UserValidatorsService, private route: ActivatedRoute, private router: Router, - private notificationsService: NotificationsService, + private notifier: Notifier, private userService: UserService, private i18n: I18n ) { @@ -43,10 +38,6 @@ export class UserPasswordComponent extends FormReactive implements OnInit, OnDes }) } - ngOnDestroy () { - // - } - formValidated () { this.error = undefined @@ -54,8 +45,7 @@ export class UserPasswordComponent extends FormReactive implements OnInit, OnDes this.userService.updateUser(this.userId, userUpdate).subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), + this.notifier.success( this.i18n('Password changed for user {{username}}.', { username: this.username }) ) }, @@ -64,16 +54,6 @@ export class UserPasswordComponent extends FormReactive implements OnInit, OnDes ) } - generatePassword () { - this.form.patchValue({ - password: generator.generate({ - length: 16, - excludeSimilarCharacters: true, - strict: true - }) - }) - } - togglePasswordVisibility () { this.showPassword = !this.showPassword } @@ -81,9 +61,4 @@ export class UserPasswordComponent extends FormReactive implements OnInit, OnDes getFormButtonTitle () { return this.i18n('Update user password') } - - private onUserFetched (userJson: User) { - this.userId = userJson.id - this.username = userJson.username - } } diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts index 4e4002a73..94ef87b08 100644 --- a/client/src/app/+admin/users/user-edit/user-update.component.ts +++ b/client/src/app/+admin/users/user-edit/user-update.component.ts @@ -1,4 +1,4 @@ -import { Component, OnDestroy, OnInit, Input } from '@angular/core' +import { Component, OnDestroy, OnInit } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { Subscription } from 'rxjs' import { Notifier } from '@app/core' @@ -93,8 +93,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { resetPassword () { this.userService.askResetPassword(this.userEmail).subscribe( () => { - this.notificationsService.success( - this.i18n('Success'), + this.notifier.success( this.i18n('An email asking for password reset has been sent to {{username}}.', { username: this.username }) ) }, -- cgit v1.2.3