diff options
Diffstat (limited to 'client/src/app/shared/shared-video-miniature/abstract-video-list.ts')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/abstract-video-list.ts | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts index da05e15fb..2219ced30 100644 --- a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts +++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts | |||
@@ -15,7 +15,7 @@ import { | |||
15 | import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' | 15 | import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' |
16 | import { GlobalIconName } from '@app/shared/shared-icons' | 16 | import { GlobalIconName } from '@app/shared/shared-icons' |
17 | import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils/miscs/date' | 17 | import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils/miscs/date' |
18 | import { ServerConfig, VideoSortField } from '@shared/models' | 18 | import { ServerConfig, UserRight, VideoFilter, VideoSortField } from '@shared/models' |
19 | import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' | 19 | import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' |
20 | import { Syndication, Video } from '../shared-main' | 20 | import { Syndication, Video } from '../shared-main' |
21 | import { MiniatureDisplayOptions, OwnerDisplayType } from './video-miniature.component' | 21 | import { MiniatureDisplayOptions, OwnerDisplayType } from './video-miniature.component' |
@@ -205,10 +205,6 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
205 | this.loadMoreVideos(true) | 205 | this.loadMoreVideos(true) |
206 | } | 206 | } |
207 | 207 | ||
208 | toggleModerationDisplay () { | ||
209 | throw new Error('toggleModerationDisplay is not implemented') | ||
210 | } | ||
211 | |||
212 | removeVideoFromArray (video: Video) { | 208 | removeVideoFromArray (video: Video) { |
213 | this.videos = this.videos.filter(v => v.id !== video.id) | 209 | this.videos = this.videos.filter(v => v.id !== video.id) |
214 | } | 210 | } |
@@ -268,6 +264,10 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
268 | return this.groupedDateLabels[this.groupedDates[video.id]] | 264 | return this.groupedDateLabels[this.groupedDates[video.id]] |
269 | } | 265 | } |
270 | 266 | ||
267 | toggleModerationDisplay () { | ||
268 | throw new Error('toggleModerationDisplay is not implemented') | ||
269 | } | ||
270 | |||
271 | // On videos hook for children that want to do something | 271 | // On videos hook for children that want to do something |
272 | protected onMoreVideos () { /* empty */ } | 272 | protected onMoreVideos () { /* empty */ } |
273 | 273 | ||
@@ -277,6 +277,28 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor | |||
277 | this.angularState = routeParams[ 'a-state' ] | 277 | this.angularState = routeParams[ 'a-state' ] |
278 | } | 278 | } |
279 | 279 | ||
280 | protected buildLocalFilter (existing: VideoFilter, base: VideoFilter) { | ||
281 | if (base === 'local') { | ||
282 | return existing === 'local' | ||
283 | ? 'all-local' as 'all-local' | ||
284 | : 'local' as 'local' | ||
285 | } | ||
286 | |||
287 | return existing === 'all' | ||
288 | ? null | ||
289 | : 'all' | ||
290 | } | ||
291 | |||
292 | protected enableAllFilterIfPossible () { | ||
293 | if (!this.authService.isLoggedIn()) return | ||
294 | |||
295 | this.authService.userInformationLoaded | ||
296 | .subscribe(() => { | ||
297 | const user = this.authService.getUser() | ||
298 | this.displayModerationBlock = user.hasRight(UserRight.SEE_ALL_VIDEOS) | ||
299 | }) | ||
300 | } | ||
301 | |||
280 | private calcPageSizes () { | 302 | private calcPageSizes () { |
281 | if (this.screenService.isInMobileView()) { | 303 | if (this.screenService.isInMobileView()) { |
282 | this.pagination.itemsPerPage = 5 | 304 | this.pagination.itemsPerPage = 5 |