From 4edee628a0a154360b30eab48924b3987ac90798 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 22 Feb 2022 11:25:03 +0100 Subject: Improve account removal message for users --- .../my-account-danger-zone/my-account-danger-zone.component.ts | 9 +++++++-- client/src/app/modal/confirm.component.ts | 10 ++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts b/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts index 4a46f1ad9..2bae3499e 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts @@ -19,8 +19,13 @@ export class MyAccountDangerZoneComponent { async deleteMe () { const res = await this.confirmService.confirmWithInput( - // eslint-disable-next-line max-len - $localize`Are you sure you want to delete your account? This will delete all your data, including channels, videos and comments. Content cached by other servers and other third-parties might make longer to be deleted.`, + $localize`Are you sure you want to delete your account?` + + '

' + + // eslint-disable-next-line max-len + $localize`This will delete all your data, including channels, videos, comments and you won't be able to create another user on this instance with "${this.user.username}" username.` + + '

' + + $localize`Content cached by other servers and other third-parties might make longer to be deleted.`, + $localize`Type your username to confirm`, this.user.username, $localize`Delete your account`, diff --git a/client/src/app/modal/confirm.component.ts b/client/src/app/modal/confirm.component.ts index 457dd1f3f..ec4e1d60f 100644 --- a/client/src/app/modal/confirm.component.ts +++ b/client/src/app/modal/confirm.component.ts @@ -1,4 +1,5 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' +import { HtmlRendererService } from '@app/core' import { ConfirmService } from '@app/core/confirm/confirm.service' import { POP_STATE_MODAL_DISMISS } from '@app/helpers' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' @@ -24,6 +25,7 @@ export class ConfirmComponent implements OnInit { constructor ( private modalService: NgbModal, + private html: HtmlRendererService, private confirmService: ConfirmService ) { } @@ -31,14 +33,18 @@ export class ConfirmComponent implements OnInit { this.confirmService.showConfirm.subscribe( ({ title, message, expectedInputValue, inputLabel, confirmButtonText }) => { this.title = title - this.message = message this.inputLabel = inputLabel this.expectedInputValue = expectedInputValue this.confirmButtonText = confirmButtonText || $localize`Confirm` - this.showModal() + this.html.toSafeHtml(message) + .then(message => { + this.message = message + + this.showModal() + }) } ) } -- cgit v1.2.3 From 89e3de8dc6dbe3c78aefb5f43e0feffd97b1af02 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 22 Feb 2022 11:41:44 +0100 Subject: Reduce latency when adding a video to playlist --- .../video-add-to-playlist.component.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts index 553930595..e4972ec10 100644 --- a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts @@ -56,6 +56,8 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, private listenToPlaylistChangeSub: Subscription private playlistsData: CachedPlaylist[] = [] + private pendingAddId: number + constructor ( protected formValidatorService: FormValidatorService, private authService: AuthService, @@ -215,8 +217,9 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, } isPrimaryCheckboxChecked (playlist: PlaylistSummary) { - return playlist.elements.filter(e => e.enabled) - .length !== 0 + // Reduce latency when adding a video to a playlist using pendingAddId + return this.pendingAddId === playlist.id || + playlist.elements.filter(e => e.enabled).length !== 0 } toggleOptionalRow (playlist: PlaylistSummary) { @@ -367,6 +370,8 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, if (element.startTimestamp) body.startTimestamp = element.startTimestamp if (element.stopTimestamp && element.stopTimestamp !== this.video.duration) body.stopTimestamp = element.stopTimestamp + this.pendingAddId = playlist.id + this.videoPlaylistService.addVideoInPlaylist(playlist.id, body) .subscribe({ next: res => { @@ -379,9 +384,17 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, if (element) element.playlistElementId = res.videoPlaylistElement.id }, - error: err => this.notifier.error(err.message), + error: err => { + this.pendingAddId = undefined + this.cd.markForCheck() + + this.notifier.error(err.message) + }, - complete: () => this.cd.markForCheck() + complete: () => { + this.pendingAddId = undefined + this.cd.markForCheck() + } }) } -- cgit v1.2.3