Merge branch 'release/v1.3.0' into develop
This commit is contained in:
commit
fd822c1c69
|
@ -67,7 +67,9 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro
|
||||||
if (previousIndex === newIndex) return
|
if (previousIndex === newIndex) return
|
||||||
|
|
||||||
const oldPosition = this.videos[previousIndex].playlistElement.position
|
const oldPosition = this.videos[previousIndex].playlistElement.position
|
||||||
const insertAfter = newIndex === 0 ? 0 : this.videos[newIndex].playlistElement.position
|
let insertAfter = this.videos[newIndex].playlistElement.position
|
||||||
|
|
||||||
|
if (oldPosition > insertAfter) insertAfter--
|
||||||
|
|
||||||
this.videoPlaylistService.reorderPlaylist(this.playlist.id, oldPosition, insertAfter)
|
this.videoPlaylistService.reorderPlaylist(this.playlist.id, oldPosition, insertAfter)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core'
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'
|
||||||
import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service'
|
import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service'
|
||||||
import { AuthService, Notifier } from '@app/core'
|
import { AuthService, Notifier } from '@app/core'
|
||||||
import { forkJoin } from 'rxjs'
|
import { forkJoin } from 'rxjs'
|
||||||
|
@ -22,7 +22,7 @@ type PlaylistSummary = {
|
||||||
templateUrl: './video-add-to-playlist.component.html',
|
templateUrl: './video-add-to-playlist.component.html',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
})
|
})
|
||||||
export class VideoAddToPlaylistComponent extends FormReactive implements OnInit {
|
export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, OnChanges {
|
||||||
@Input() video: Video
|
@Input() video: Video
|
||||||
@Input() currentVideoTimestamp: number
|
@Input() currentVideoTimestamp: number
|
||||||
@Input() lazyLoad = false
|
@Input() lazyLoad = false
|
||||||
|
@ -54,15 +54,33 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.resetOptions(true)
|
|
||||||
|
|
||||||
this.buildForm({
|
this.buildForm({
|
||||||
displayName: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_DISPLAY_NAME
|
displayName: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_DISPLAY_NAME
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges (simpleChanges: SimpleChanges) {
|
||||||
|
if (simpleChanges['video']) {
|
||||||
|
this.unload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init () {
|
||||||
|
this.resetOptions(true)
|
||||||
|
|
||||||
if (this.lazyLoad !== true) this.load()
|
if (this.lazyLoad !== true) this.load()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unload () {
|
||||||
|
this.videoPlaylists = []
|
||||||
|
|
||||||
|
this.init()
|
||||||
|
|
||||||
|
this.cd.markForCheck()
|
||||||
|
}
|
||||||
|
|
||||||
load () {
|
load () {
|
||||||
forkJoin([
|
forkJoin([
|
||||||
this.videoPlaylistService.listAccountPlaylists(this.user.account, '-updatedAt'),
|
this.videoPlaylistService.listAccountPlaylists(this.user.account, '-updatedAt'),
|
||||||
|
|
|
@ -79,6 +79,11 @@ export class VideoActionsDropdownComponent implements OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges () {
|
ngOnChanges () {
|
||||||
|
if (this.loaded) {
|
||||||
|
this.loaded = false
|
||||||
|
this.playlistAdd.unload()
|
||||||
|
}
|
||||||
|
|
||||||
this.buildActions()
|
this.buildActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ $player-factor: 1.7; // 16/9
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
height: auto !important;
|
height: auto !important;
|
||||||
max-height: 300px !important;
|
max-height: 300px !important;
|
||||||
|
max-width: initial;
|
||||||
border-bottom: 1px solid $separator-border-color !important;
|
border-bottom: 1px solid $separator-border-color !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,23 +119,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
if (videoId) this.loadVideo(videoId)
|
if (videoId) this.loadVideo(videoId)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.hotkeys = [
|
this.initHotkeys()
|
||||||
new Hotkey('shift+l', (event: KeyboardEvent): boolean => {
|
|
||||||
this.setLike()
|
|
||||||
return false
|
|
||||||
}, undefined, this.i18n('Like the video')),
|
|
||||||
new Hotkey('shift+d', (event: KeyboardEvent): boolean => {
|
|
||||||
this.setDislike()
|
|
||||||
return false
|
|
||||||
}, undefined, this.i18n('Dislike the video')),
|
|
||||||
new Hotkey('shift+s', (event: KeyboardEvent): boolean => {
|
|
||||||
this.subscribeButton.subscribed ?
|
|
||||||
this.subscribeButton.unsubscribe() :
|
|
||||||
this.subscribeButton.subscribe()
|
|
||||||
return false
|
|
||||||
}, undefined, this.i18n('Subscribe to the account'))
|
|
||||||
]
|
|
||||||
if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy () {
|
ngOnDestroy () {
|
||||||
|
@ -565,4 +549,24 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
this.player = undefined
|
this.player = undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private initHotkeys () {
|
||||||
|
this.hotkeys = [
|
||||||
|
new Hotkey('shift+l', (event: KeyboardEvent): boolean => {
|
||||||
|
this.setLike()
|
||||||
|
return false
|
||||||
|
}, undefined, this.i18n('Like the video')),
|
||||||
|
new Hotkey('shift+d', (event: KeyboardEvent): boolean => {
|
||||||
|
this.setDislike()
|
||||||
|
return false
|
||||||
|
}, undefined, this.i18n('Dislike the video')),
|
||||||
|
new Hotkey('shift+s', (event: KeyboardEvent): boolean => {
|
||||||
|
this.subscribeButton.subscribed ?
|
||||||
|
this.subscribeButton.unsubscribe() :
|
||||||
|
this.subscribeButton.subscribe()
|
||||||
|
return false
|
||||||
|
}, undefined, this.i18n('Subscribe to the account'))
|
||||||
|
]
|
||||||
|
if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,18 +12,19 @@ import { isFlagActivityValid } from './flag'
|
||||||
import { isPlaylistObjectValid } from './playlist'
|
import { isPlaylistObjectValid } from './playlist'
|
||||||
|
|
||||||
function isRootActivityValid (activity: any) {
|
function isRootActivityValid (activity: any) {
|
||||||
return Array.isArray(activity['@context']) && (
|
return isCollection(activity) || isActivity(activity)
|
||||||
(
|
}
|
||||||
(activity.type === 'Collection' || activity.type === 'OrderedCollection') &&
|
|
||||||
|
function isCollection (activity: any) {
|
||||||
|
return (activity.type === 'Collection' || activity.type === 'OrderedCollection') &&
|
||||||
validator.isInt(activity.totalItems, { min: 0 }) &&
|
validator.isInt(activity.totalItems, { min: 0 }) &&
|
||||||
Array.isArray(activity.items)
|
Array.isArray(activity.items)
|
||||||
) ||
|
}
|
||||||
(
|
|
||||||
isActivityPubUrlValid(activity.id) &&
|
function isActivity (activity: any) {
|
||||||
|
return isActivityPubUrlValid(activity.id) &&
|
||||||
exists(activity.actor) &&
|
exists(activity.actor) &&
|
||||||
(isActivityPubUrlValid(activity.actor) || isActivityPubUrlValid(activity.actor.id))
|
(isActivityPubUrlValid(activity.actor) || isActivityPubUrlValid(activity.actor.id))
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const activityCheckers: { [ P in ActivityType ]: (activity: Activity) => boolean } = {
|
const activityCheckers: { [ P in ActivityType ]: (activity: Activity) => boolean } = {
|
||||||
|
|
Loading…
Reference in New Issue