]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Client: fix update button displayed on non owned video
authorChocobozzz <florian.bigard@gmail.com>
Fri, 5 May 2017 12:11:01 +0000 (14:11 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 5 May 2017 12:11:01 +0000 (14:11 +0200)
client/src/app/videos/shared/video.model.ts
client/src/app/videos/video-watch/video-watch.component.ts
server/tests/api/video-abuse.js
server/tests/api/video-blacklist.js

index 1cfb312b6efb0007693df6f3459bd5edaf16ce27..fafdb4ac4b114548f0692f42b0aee32bd0f5a610 100644 (file)
@@ -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));
index 07b2a1d1f30736f80823c0683500901bef2ef8dc..756f667269e56fb459394e7086025face2a73889 100644 (file)
@@ -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() {
index a9af74857b297df6721806749fea2baeb0eceaa3..c2b6186bd8bef6fed88acae71329a8d1c0257a65 100644 (file)
@@ -17,7 +17,7 @@ describe('Test video abuses', function () {
   let servers = []
 
   before(function (done) {
-    this.timeout(30000)
+    this.timeout(40000)
 
     series([
       // Run servers
index 6287b9b088a9902bde42c1578f2840c1ebe3bb5c..20b7c5de3b7c509d7258e1b6d878c06edfb0a2d2 100644 (file)
@@ -17,7 +17,7 @@ describe('Test video blacklists', function () {
   let servers = []
 
   before(function (done) {
-    this.timeout(30000)
+    this.timeout(40000)
 
     series([
       // Run servers