Skip to content

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

Client: fix update button displayed on non owned video

Chocobozzz9eee32fc34ec
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts
index 1cfb312b6e..fafdb4ac4b 100644
--- a/client/src/app/videos/shared/video.model.ts
+++ b/client/src/app/videos/shared/video.model.ts
@@ -93,6 +93,10 @@ export class Video {
return user && user.isAdmin() === true && this.isLocal === false;
}
+ isUpdatableBy(user) {
+ return user && this.isLocal === true && user.username === this.author;
+ }
+
isVideoNSFWForUser(user: User) {
// If the video is NSFW and the user is not logged in, or the user does not want to display NSFW videos...
return (this.nsfw && (!user || user.displayNSFW === false));
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts
index 07b2a1d1f3..756f667269 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -229,8 +229,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
}
canUserUpdateVideo() {
- return this.authService.getUser() !== null &&
- this.authService.getUser().username === this.video.author;
+ return this.video.isUpdatableBy(this.authService.getUser());
}
isVideoRemovable() {
diff --git a/server/tests/api/video-abuse.js b/server/tests/api/video-abuse.js
index a9af74857b..c2b6186bd8 100644
--- a/server/tests/api/video-abuse.js
+++ b/server/tests/api/video-abuse.js
@@ -17,7 +17,7 @@ describe('Test video abuses', function () {
let servers = []
before(function (done) {
- this.timeout(30000)
+ this.timeout(40000)
series([
// Run servers
diff --git a/server/tests/api/video-blacklist.js b/server/tests/api/video-blacklist.js
index 6287b9b088..20b7c5de3b 100644
--- a/server/tests/api/video-blacklist.js
+++ b/server/tests/api/video-blacklist.js
@@ -17,7 +17,7 @@ describe('Test video blacklists', function () {
let servers = []
before(function (done) {
- this.timeout(30000)
+ this.timeout(40000)
series([
// Run servers