From 6c8b7d0052ada90e0c96ffac50f3427324d8baf4 Mon Sep 17 00:00:00 2001 From: Tzahi12345 Date: Fri, 13 Jan 2023 22:52:52 -0500 Subject: [PATCH] Improved UX in share dialog and video info dialog --- Public API v1.yaml | 2 ++ src/api-types/models/DatabaseFile.ts | 1 + .../share-media-dialog/share-media-dialog.component.html | 2 +- .../share-media-dialog/share-media-dialog.component.ts | 2 +- .../video-info-dialog/video-info-dialog.component.html | 4 ++-- .../dialogs/video-info-dialog/video-info-dialog.component.ts | 2 ++ src/app/player/player.component.ts | 2 +- 7 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Public API v1.yaml b/Public API v1.yaml index 124a7d8..9d61076 100644 --- a/Public API v1.yaml +++ b/Public API v1.yaml @@ -2463,6 +2463,8 @@ components: type: string uid: type: string + user_uid: + type: string sharingEnabled: type: boolean category: diff --git a/src/api-types/models/DatabaseFile.ts b/src/api-types/models/DatabaseFile.ts index 4dfd2b3..855aa61 100644 --- a/src/api-types/models/DatabaseFile.ts +++ b/src/api-types/models/DatabaseFile.ts @@ -26,6 +26,7 @@ export type DatabaseFile = { path: string; upload_date: string; uid: string; + user_uid?: string; sharingEnabled?: boolean; category?: Category; view_count?: number; diff --git a/src/app/dialogs/share-media-dialog/share-media-dialog.component.html b/src/app/dialogs/share-media-dialog/share-media-dialog.component.html index fd01a0e..0b9c659 100644 --- a/src/app/dialogs/share-media-dialog/share-media-dialog.component.html +++ b/src/app/dialogs/share-media-dialog/share-media-dialog.component.html @@ -6,7 +6,7 @@
- Enable sharing + Enable sharing
Use timestamp diff --git a/src/app/dialogs/share-media-dialog/share-media-dialog.component.ts b/src/app/dialogs/share-media-dialog/share-media-dialog.component.ts index e4f2912..5f5dd50 100644 --- a/src/app/dialogs/share-media-dialog/share-media-dialog.component.ts +++ b/src/app/dialogs/share-media-dialog/share-media-dialog.component.ts @@ -21,7 +21,7 @@ export class ShareMediaDialogComponent implements OnInit { timestamp_enabled = false; constructor(@Inject(MAT_DIALOG_DATA) public data: any, public router: Router, private snackBar: MatSnackBar, - private postsService: PostsService) { } + public postsService: PostsService) { } ngOnInit(): void { if (this.data) { diff --git a/src/app/dialogs/video-info-dialog/video-info-dialog.component.html b/src/app/dialogs/video-info-dialog/video-info-dialog.component.html index d35e4b4..609bc42 100644 --- a/src/app/dialogs/video-info-dialog/video-info-dialog.component.html +++ b/src/app/dialogs/video-info-dialog/video-info-dialog.component.html @@ -1,8 +1,8 @@

{{file.title}}
- - + +

diff --git a/src/app/dialogs/video-info-dialog/video-info-dialog.component.ts b/src/app/dialogs/video-info-dialog/video-info-dialog.component.ts index e6c3152..54c1006 100644 --- a/src/app/dialogs/video-info-dialog/video-info-dialog.component.ts +++ b/src/app/dialogs/video-info-dialog/video-info-dialog.component.ts @@ -20,6 +20,7 @@ export class VideoInfoDialogComponent implements OnInit { editing = false; initialized = false; retrieving_file = false; + write_access = false; constructor(@Inject(MAT_DIALOG_DATA) public data: any, public postsService: PostsService, private datePipe: DatePipe) { } @@ -29,6 +30,7 @@ export class VideoInfoDialogComponent implements OnInit { this.initializeFile(this.data.file); } this.postsService.reloadCategories(); + this.write_access = !this.file.user_uid || (this.file.user_uid && this.postsService.user?.uid === this.file.user_uid); } initializeFile(file: DatabaseFile): void { diff --git a/src/app/player/player.component.ts b/src/app/player/player.component.ts index 8040bc6..c21d33c 100644 --- a/src/app/player/player.component.ts +++ b/src/app/player/player.component.ts @@ -353,7 +353,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy { uid: this.playlist_id ? this.playlist_id : this.uid, sharing_enabled: this.playlist_id ? this.db_playlist.sharingEnabled : this.db_file.sharingEnabled, is_playlist: !!this.playlist_id, - uuid: this.postsService.isLoggedIn ? this.postsService.user.uid : null, + uuid: this.postsService.isLoggedIn ? this.postsService.user.uid : this.uuid, current_timestamp: this.api.time.current }, width: '60vw'