Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Remember modal states

Chocobozzz02d72dcb9394
diff --git a/client/src/app/+video-watch/shared/action-buttons/action-buttons.component.html b/client/src/app/+video-watch/shared/action-buttons/action-buttons.component.html
index 79d4eac932..a833eda0a5 100644
--- a/client/src/app/+video-watch/shared/action-buttons/action-buttons.component.html
+++ b/client/src/app/+video-watch/shared/action-buttons/action-buttons.component.html
@@ -35,26 +35,28 @@
</div>
}
- @if (!isUserLoggedIn() && !video().isLive) {
- @if (isVideoDownloadable()) {
- <button
- class="action-button action-button-download"
- (click)="showDownloadModal()" (keydown.enter)="showDownloadModal()"
- aria-label="Open the modal to download this video" i18n-ariaLabel
- >
- <my-global-icon iconName="download" aria-hidden="true"></my-global-icon>
- <span class="icon-text d-none d-sm-inline" i18n>DOWNLOAD</span>
- </button>
- }
+ @if (!isUserLoggedIn() && isVideoDownloadable()) {
+ <button
+ class="action-button action-button-download"
+ (click)="showDownloadModal()" (keydown.enter)="showDownloadModal()"
+ aria-label="Open the modal to download this video" i18n-ariaLabel
+ >
+ <my-global-icon iconName="download" aria-hidden="true"></my-global-icon>
+ <span class="icon-text d-none d-sm-inline" i18n>DOWNLOAD</span>
+ </button>
+ }
- <my-video-download #videoDownloadModal [videoPassword]="videoPassword()"></my-video-download>
+ @if (!isUserLoggedIn() && !video().isLive) {
+ <my-video-download #videoDownloadModal [videoPassword]="videoPassword()" (modalClosed)="modalClosed.emit('download')"></my-video-download>
}
<my-video-actions-dropdown
+ #videoActionsDropdown
[video]="video()" [videoCaptions]="videoCaptions()" [transcriptionWidgetOpened]="transcriptionWidgetOpened()"
[displayOptions]="videoActionsOptions" (videoRemoved)="onVideoRemoved()"
(showTranscriptionWidget)="showTranscriptionWidget.emit()" (hideTranscriptionWidget)="hideTranscriptionWidget.emit()"
placement="bottom auto" buttonIcon="more-horizontal" buttonStyled="true"
+ (modalClosed)="modalClosed.emit($event)" (modalOpened)="modalOpened.emit($event)"
actionAvailabilityHint="true"
></my-video-actions-dropdown>
</div>
@@ -75,5 +77,9 @@
@if (video()) {
<my-support-modal #supportModal [name]="video().channel.displayName" [content]="video().support"></my-support-modal>
- <my-video-share #videoShareModal [video]="video()" [videoCaptions]="videoCaptions()" [playlist]="playlist()"></my-video-share>
+
+ <my-video-share
+ #videoShareModal [video]="video()" [videoCaptions]="videoCaptions()" [playlist]="playlist()"
+ (modalClosed)="modalClosed.emit('share')"
+ ></my-video-share>
}
diff --git a/client/src/app/+video-watch/shared/action-buttons/action-buttons.component.ts b/client/src/app/+video-watch/shared/action-buttons/action-buttons.component.ts
index 0535f9eb9d..3fabcfdb5f 100644
--- a/client/src/app/+video-watch/shared/action-buttons/action-buttons.component.ts
+++ b/client/src/app/+video-watch/shared/action-buttons/action-buttons.component.ts
@@ -6,13 +6,19 @@ import { VideoDetails } from '@app/shared/shared-main/video/video-details.model'
import { VideoShareComponent } from '@app/shared/shared-share-modal/video-share.component'
import { SupportModalComponent } from '@app/shared/shared-support-modal/support-modal.component'
import { VideoDownloadComponent } from '@app/shared/shared-video-miniature/download/video-download.component'
-import { VideoActionsDisplayType, VideoActionsDropdownComponent } from '@app/shared/shared-video-miniature/video-actions-dropdown.component'
+import {
+ VideoActionsDisplayType,
+ VideoActionsDropdownComponent,
+ VideoActionsModalName
+} from '@app/shared/shared-video-miniature/video-actions-dropdown.component'
import { VideoAddToPlaylistComponent } from '@app/shared/shared-video-playlist/video-add-to-playlist.component'
import { VideoPlaylist } from '@app/shared/shared-video-playlist/video-playlist.model'
import { NgbDropdown, NgbDropdownMenu, NgbDropdownToggle, NgbTooltip } from '@ng-bootstrap/ng-bootstrap'
import { UserVideoRateType, VideoCaption, VideoPrivacy } from '@peertube/peertube-models'
import { VideoRateComponent } from './video-rate.component'
+export type VideoWatchModalName = VideoActionsModalName | 'share'
+
@Component({
selector: 'my-action-buttons',
templateUrl: './action-buttons.component.html',
@@ -41,6 +47,7 @@ export class ActionButtonsComponent implements OnChanges {
readonly videoShareModal = viewChild<VideoShareComponent>('videoShareModal')
readonly supportModal = viewChild<SupportModalComponent>('supportModal')
readonly videoDownloadModal = viewChild<VideoDownloadComponent>('videoDownloadModal')
+ readonly videoActionsDropdown = viewChild<VideoActionsDropdownComponent>('videoActionsDropdown')
readonly video = input<VideoDetails>(undefined)
readonly videoPassword = input<string>(undefined)
@@ -58,6 +65,9 @@ export class ActionButtonsComponent implements OnChanges {
readonly showTranscriptionWidget = output()
readonly hideTranscriptionWidget = output()
+ readonly modalOpened = output<VideoWatchModalName>()
+ readonly modalClosed = output<VideoWatchModalName>()
+
likesBarTooltipText = ''
tooltipSupport = ''
@@ -99,11 +109,20 @@ export class ActionButtonsComponent implements OnChanges {
}
showDownloadModal () {
+ // Logged-in users download the video through the "..." dropdown, which has its own modal instance
+ if (this.isUserLoggedIn()) {
+ this.videoActionsDropdown()?.showDownloadModal()
+ return
+ }
+
+ this.modalOpened.emit('download')
+
this.videoDownloadModal().show(this.video(), this.videoCaptions())
}
isVideoDownloadable () {
const video = this.video()
+
return video && video instanceof VideoDetails && video.downloadEnabled && !video.isLive
}
@@ -112,6 +131,8 @@ export class ActionButtonsComponent implements OnChanges {
}
showShareModal () {
+ this.modalOpened.emit('share')
+
this.videoShareModal().show(this.currentTime(), this.currentPlaylistPosition())
}
diff --git a/client/src/app/+video-watch/video-watch.component.html b/client/src/app/+video-watch/video-watch.component.html
index 32883bceb3..27e5e70211 100644
--- a/client/src/app/+video-watch/video-watch.component.html
+++ b/client/src/app/+video-watch/video-watch.component.html
@@ -24,7 +24,7 @@
@if (transcriptionWidgetOpened) {
<my-video-transcription
[video]="video" [captions]="videoCaptions" [currentTime]="getCurrentTime()"
- (segmentClicked)="handleTimestampClicked($event)" (closeTranscription)="transcriptionWidgetOpened = false"
+ (segmentClicked)="handleTimestampClicked($event)" (closeTranscription)="closeTranscriptionWidget()"
></my-video-transcription>
}
</div>
@@ -50,12 +50,15 @@
•
<my-video-views-counter [isLive]="video.isLive" [viewers]="video.viewers" [views]="video.views"></my-video-views-counter>
</div>
+
<my-action-buttons
+ #actionButtons
[video]="video" [videoPassword]="videoPassword" [videoCaptions]="videoCaptions"
[isUserLoggedIn]="isUserLoggedIn()" [isUserOwner]="isUserOwner()"
[transcriptionWidgetOpened]="transcriptionWidgetOpened"
[playlist]="playlist" [currentTime]="getCurrentTime()" [currentPlaylistPosition]="getCurrentPlaylistPosition()"
- (showTranscriptionWidget)="transcriptionWidgetOpened = true" (hideTranscriptionWidget)="transcriptionWidgetOpened = false"
+ (showTranscriptionWidget)="openTranscriptionWidget()" (hideTranscriptionWidget)="closeTranscriptionWidget()"
+ (modalOpened)="onActionButtonsModalOpened($event)" (modalClosed)="onActionButtonsModalClosed($event)"
></my-action-buttons>
</div>
</div>
diff --git a/client/src/app/+video-watch/video-watch.component.ts b/client/src/app/+video-watch/video-watch.component.ts
index ca636eebe8..033bff093f 100644
--- a/client/src/app/+video-watch/video-watch.component.ts
+++ b/client/src/app/+video-watch/video-watch.component.ts
@@ -1,5 +1,17 @@
import { CommonModule, PlatformLocation } from '@angular/common'
-import { ChangeDetectionStrategy, Component, ElementRef, inject, LOCALE_ID, NgZone, OnDestroy, OnInit, viewChild } from '@angular/core'
+import {
+ afterNextRender,
+ ChangeDetectionStrategy,
+ Component,
+ ElementRef,
+ inject,
+ Injector,
+ LOCALE_ID,
+ NgZone,
+ OnDestroy,
+ OnInit,
+ viewChild
+} from '@angular/core'
import { ActivatedRoute, Params, Router, RouterLink } from '@angular/router'
import {
AuthService,
@@ -9,6 +21,7 @@ import {
HotkeysService,
MetaService,
Notifier,
+ PeerTubeRouterService,
PeerTubeSocket,
PluginService,
RestExtractor,
@@ -68,7 +81,7 @@ import { DateToggleComponent } from '../shared/shared-main/date/date-toggle.comp
import { PluginPlaceholderComponent } from '../shared/shared-main/plugins/plugin-placeholder.component'
import { VideoViewsCounterComponent } from '../shared/shared-video/video-views-counter.component'
import { PlayerStylesComponent } from './player-styles.component'
-import { ActionButtonsComponent } from './shared/action-buttons/action-buttons.component'
+import { ActionButtonsComponent, VideoWatchModalName } from './shared/action-buttons/action-buttons.component'
import { VideoCommentsComponent } from './shared/comment/video-comments.component'
import { PrivacyConcernsComponent } from './shared/information/privacy-concerns.component'
import { VideoAlertComponent } from './shared/information/video-alert.component'
@@ -151,10 +164,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
private location = inject(PlatformLocation)
private metaService = inject(MetaService)
private localeId = inject(LOCALE_ID)
+ private peertubeRouter = inject(PeerTubeRouterService)
+ private injector = inject(Injector)
readonly videoWatchPlaylist = viewChild<VideoWatchPlaylistComponent>('videoWatchPlaylist')
readonly subscribeButton = viewChild<SubscribeButtonComponent>('subscribeButton')
readonly playerElement = viewChild<ElementRef<HTMLVideoElement>>('playerElement')
+ readonly actionButtons = viewChild<ActionButtonsComponent>('actionButtons')
peertubePlayer: PeerTubePlayer
theaterEnabled = false
@@ -175,6 +191,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
transcriptionWidgetOpened = false
+ private initialModalQueryParamHandled = false
+ private initialTranscriptionQueryParamHandled = false
+
+ private lastHandledStartQueryParam: string
+
private nextRecommendedVideoId = ''
private nextRecommendedVideoTitle = ''
@@ -290,6 +311,87 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
// ---------------------------------------------------------------------------
+ openTranscriptionWidget () {
+ this.transcriptionWidgetOpened = true
+
+ this.updateTranscriptionQueryParam(true)
+ }
+
+ closeTranscriptionWidget () {
+ this.transcriptionWidgetOpened = false
+
+ this.updateTranscriptionQueryParam(false)
+ }
+
+ private updateTranscriptionQueryParam (opened: boolean) {
+ this.silentNavigate({ transcription: opened ? true : null })
+ }
+
+ private restoreTranscriptionWidgetIfNeeded () {
+ if (!this.initialTranscriptionQueryParamHandled) {
+ this.initialTranscriptionQueryParamHandled = true
+
+ const requestedFromQueryParam = toBoolean(this.route.snapshot.queryParams.transcription) === true
+
+ if (requestedFromQueryParam && this.videoCaptions.length !== 0) {
+ this.transcriptionWidgetOpened = true
+ } else if (requestedFromQueryParam) {
+ // Captions are gone (or were never there): drop the stale query param instead of opening an empty widget
+ this.updateTranscriptionQueryParam(false)
+ }
+ }
+
+ if (this.transcriptionWidgetOpened && this.videoCaptions.length === 0) {
+ this.closeTranscriptionWidget()
+ }
+ }
+
+ // ---------------------------------------------------------------------------
+
+ onActionButtonsModalOpened (modal: VideoWatchModalName) {
+ if (modal === 'download' || modal === 'share') {
+ this.silentNavigate({ openModal: modal })
+ }
+ }
+
+ onActionButtonsModalClosed (modal: VideoWatchModalName) {
+ if (modal === 'download' || modal === 'share') {
+ this.silentNavigate({ openModal: null })
+ }
+ }
+
+ private restoreModalFromQueryParamIfNeeded () {
+ if (this.initialModalQueryParamHandled) return
+
+ this.initialModalQueryParamHandled = true
+
+ afterNextRender(() => this.openModalFromQueryParamIfNeeded(), { injector: this.injector })
+ }
+
+ private openModalFromQueryParamIfNeeded () {
+ const openModal = this.route.snapshot.queryParams.openModal
+ if (openModal !== 'download' && openModal !== 'share') return
+
+ const actionButtons = this.actionButtons()
+ if (!actionButtons) return
+
+ if (openModal === 'download' && actionButtons.isVideoDownloadable()) {
+ actionButtons.showDownloadModal()
+ return
+ }
+
+ if (openModal === 'share') {
+ actionButtons.showShareModal()
+ return
+ }
+ }
+
+ private silentNavigate (queryParams: Params) {
+ this.peertubeRouter.silentNavigate([], { ...this.route.snapshot.queryParams, ...queryParams }, this.route)
+ }
+
+ // ---------------------------------------------------------------------------
+
handleTimestampClicked (timestamp: number) {
if (!this.peertubePlayer || this.video.isLive) return
@@ -358,7 +460,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.videoWatchPlaylist().updatePlaylistIndex(this.playlistPosition)
const start = queryParams['start']
- if (this.peertubePlayer?.getPlayer() && start) {
+ if (this.peertubePlayer?.getPlayer() && start && start !== this.lastHandledStartQueryParam) {
+ this.lastHandledStartQueryParam = start
+
this.peertubePlayer.setCurrentTime(parseInt(start, 10))
}
})
@@ -538,6 +642,27 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
})
}
+ private async isDisplayCancelledBecauseNSFW (video: VideoDetails, loggedInOrAnonymousUser: User) {
+ if (!video.isNSFWHiddenForUser(loggedInOrAnonymousUser, this.serverConfig)) return false
+
+ const res = await this.confirmService.confirm(
+ $localize`This video contains sensitive content. Are you sure you want to display the video page?`,
+ $localize`Sensitive video`,
+ {
+ confirmButtonText: $localize`Display the page`,
+ cancelButtonText: $localize`Quit that page`,
+ moreInfo: video.nsfwSummary
+ ? {
+ title: $localize`Learn more`,
+ content: video.nsfwSummary
+ }
+ : undefined
+ }
+ )
+
+ return res === false
+ }
+
private async onVideoFetched (options: {
video: VideoDetails
live: LiveVideo
@@ -579,28 +704,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.remoteServerDown = false
this.currentTime = undefined
- if (this.transcriptionWidgetOpened && this.videoCaptions.length === 0) {
- this.transcriptionWidgetOpened = false
- }
+ this.restoreTranscriptionWidgetIfNeeded()
- if (this.video.isNSFWHiddenForUser(loggedInOrAnonymousUser, this.serverConfig)) {
- const res = await this.confirmService.confirm(
- $localize`This video contains sensitive content. Are you sure you want to display the video page?`,
- $localize`Sensitive video`,
- {
- confirmButtonText: $localize`Display the page`,
- cancelButtonText: $localize`Quit that page`,
- moreInfo: video.nsfwSummary
- ? {
- title: $localize`Learn more`,
- content: video.nsfwSummary
- }
- : undefined
- }
- )
- if (res === false) return this.location.back()
+ if (await this.isDisplayCancelledBecauseNSFW(video, loggedInOrAnonymousUser) === true) {
+ return this.location.back()
}
+ this.restoreModalFromQueryParamIfNeeded()
+
this.buildHotkeysHelp(video)
this.setMetaTags(video)
diff --git a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts
index 84b173e05c..e226125cb6 100644
--- a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts
+++ b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts
@@ -1,5 +1,5 @@
import { NgClass } from '@angular/common'
-import { Component, OnInit, inject, input, viewChild, ChangeDetectionStrategy } from '@angular/core'
+import { Component, OnInit, inject, input, output, viewChild, ChangeDetectionStrategy } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { Notifier } from '@app/core'
import { ABUSE_REASON_VALIDATOR } from '@app/shared/form-validators/abuse-validators'
@@ -43,6 +43,8 @@ export class VideoReportComponent extends FormReactive implements OnInit {
readonly modal = viewChild<NgbModal>('modal')
+ readonly modalClosed = output()
+
error: string = null
predefinedReasons: { id: AbusePredefinedReasonsString, label: string, description?: string, help?: string }[] = []
@@ -81,6 +83,8 @@ export class VideoReportComponent extends FormReactive implements OnInit {
show () {
this.openedModal = this.modalService.open(this.modal(), { centered: true, keyboard: false, size: 'lg' })
+
+ this.openedModal.hidden.subscribe(() => this.modalClosed.emit())
}
hide () {
diff --git a/client/src/app/shared/shared-moderation/video-block.component.ts b/client/src/app/shared/shared-moderation/video-block.component.ts
index b306a68fd9..76bfe4a666 100644
--- a/client/src/app/shared/shared-moderation/video-block.component.ts
+++ b/client/src/app/shared/shared-moderation/video-block.component.ts
@@ -28,6 +28,7 @@ export class VideoBlockComponent extends FormReactive implements OnInit {
readonly modal = viewChild<NgbModal>('modal')
readonly videoBlocked = output()
+ readonly modalClosed = output()
videos: Video[]
@@ -64,6 +65,8 @@ export class VideoBlockComponent extends FormReactive implements OnInit {
this.videos = videos
this.openedModal = this.modalService.open(this.modal(), { centered: true, keyboard: false })
+
+ this.openedModal.hidden.subscribe(() => this.modalClosed.emit())
}
hide () {
diff --git a/client/src/app/shared/shared-share-modal/video-share.component.ts b/client/src/app/shared/shared-share-modal/video-share.component.ts
index 382e8f244b..9b53eb17fc 100644
--- a/client/src/app/shared/shared-share-modal/video-share.component.ts
+++ b/client/src/app/shared/shared-share-modal/video-share.component.ts
@@ -1,4 +1,4 @@
-import { Component, ElementRef, inject, input, model, viewChild, ChangeDetectionStrategy } from '@angular/core'
+import { Component, ElementRef, inject, input, model, output, viewChild, ChangeDetectionStrategy } from '@angular/core'
import { HooksService, ServerService } from '@app/core'
import { VideoDetails } from '@app/shared/shared-main/video/video-details.model'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
@@ -33,6 +33,8 @@ export class VideoShareComponent {
readonly playlist = input<VideoPlaylist>(null)
readonly playlistPosition = model<number>(null)
+ readonly modalClosed = output()
+
customizations: Customizations
show (currentVideoTimestamp?: number, currentPlaylistPosition?: number) {
@@ -88,9 +90,13 @@ export class VideoShareComponent {
this.onUpdate()
- this.modalService.open(this.modal(), { centered: true }).shown.subscribe(() => {
+ const activeModal = this.modalService.open(this.modal(), { centered: true })
+
+ activeModal.shown.subscribe(() => {
this.hooks.runAction('action:modal.share.shown', 'video-watch', { video: this.video(), playlist: this.playlist() })
})
+
+ activeModal.hidden.subscribe(() => this.modalClosed.emit())
}
onUpdate () {
diff --git a/client/src/app/shared/shared-video-miniature/download/video-download.component.ts b/client/src/app/shared/shared-video-miniature/download/video-download.component.ts
index 11798c08f3..55171f0069 100644
--- a/client/src/app/shared/shared-video-miniature/download/video-download.component.ts
+++ b/client/src/app/shared/shared-video-miniature/download/video-download.component.ts
@@ -1,5 +1,5 @@
import { NgClass, NgTemplateOutlet } from '@angular/common'
-import { Component, ElementRef, inject, input, viewChild, ChangeDetectionStrategy } from '@angular/core'
+import { Component, ElementRef, inject, input, output, viewChild, ChangeDetectionStrategy } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { AuthService, HooksService } from '@app/core'
import { GlobalIconComponent } from '@app/shared/shared-icons/global-icon.component'
@@ -44,6 +44,8 @@ export class VideoDownloadComponent {
readonly videoPassword = input<string>(undefined)
+ readonly modalClosed = output()
+
video: VideoDetails
type: DownloadType = 'video-generate'
@@ -93,6 +95,8 @@ export class VideoDownloadComponent {
this.activeModal.shown.subscribe(() => {
this.hooks.runAction('action:modal.video-download.shown', 'common')
})
+
+ this.activeModal.hidden.subscribe(() => this.modalClosed.emit())
}
private getOriginalVideoFileObs () {
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html
index 8ab7813f76..fd92a7c522 100644
--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html
+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.html
@@ -33,9 +33,9 @@
(openChange)="dropdownOpened = true"
></my-action-dropdown>
- <my-video-download #videoDownloadModal></my-video-download>
+ <my-video-download #videoDownloadModal (modalClosed)="modalClosed.emit('download')"></my-video-download>
- <my-video-report #videoReportModal [video]="video()"></my-video-report>
+ <my-video-report #videoReportModal [video]="video()" (modalClosed)="modalClosed.emit('report')"></my-video-report>
- <my-video-block #videoBlockModal (videoBlocked)="onVideoBlocked()"></my-video-block>
+ <my-video-block #videoBlockModal (videoBlocked)="onVideoBlocked()" (modalClosed)="modalClosed.emit('block')"></my-video-block>
}
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
index 6b6eab2533..4eda733475 100644
--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
@@ -23,6 +23,8 @@ import { VideoBlockService } from '../shared-moderation/video-block.service'
import { VideoAddToPlaylistComponent } from '../shared-video-playlist/video-add-to-playlist.component'
import { VideoDownloadComponent } from './download/video-download.component'
+export type VideoActionsModalName = 'download' | 'report' | 'block' | 'remove'
+
export type VideoActionsDisplayType = {
playlist?: boolean
download?: boolean
@@ -120,9 +122,11 @@ export class VideoActionsDropdownComponent implements OnChanges {
readonly unmuted = output()
readonly transcodingCreated = output()
readonly videoImportRetried = output()
- readonly modalOpened = output()
readonly videoExistsInPlaylistChange = output()
+ readonly modalOpened = output<VideoActionsModalName>()
+ readonly modalClosed = output<VideoActionsModalName>()
+
readonly showTranscriptionWidget = output()
readonly hideTranscriptionWidget = output()
@@ -150,7 +154,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
// ---------------------------------------------------------------------------
showDownloadModal () {
- this.modalOpened.emit()
+ this.modalOpened.emit('download')
const video = this.video()
const obs = video instanceof VideoDetails
@@ -163,13 +167,13 @@ export class VideoActionsDropdownComponent implements OnChanges {
}
showReportModal () {
- this.modalOpened.emit()
+ this.modalOpened.emit('report')
this.videoReportModal().show()
}
showBlockModal () {
- this.modalOpened.emit()
+ this.modalOpened.emit('block')
this.videoBlockModal().show([ this.video() ])
}
@@ -314,7 +318,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
}
async removeVideo () {
- this.modalOpened.emit()
+ this.modalOpened.emit('remove')
let message = $localize`Do you really want to delete ${this.video().name}?`
const video = this.video()
@@ -330,9 +334,14 @@ export class VideoActionsDropdownComponent implements OnChanges {
next: () => {
this.notifier.success($localize`Video ${this.video().name} deleted.`)
this.videoRemoved.emit()
+ this.modalClosed.emit('remove')
},
- error: err => this.notifier.handleError(err)
+ error: err => {
+ this.modalOpened.emit('remove')
+
+ this.notifier.handleError(err)
+ }
})
}