aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-05-05 14:11:01 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-05-05 14:11:01 +0200
commit9eee32fc34ece1cc5e624ae15d81bfede68be33f (patch)
tree51490553777779572d2adfa7c5f1c117defbedce
parentb1ed221747d6829232d2311c11e4fd26faa43c4f (diff)
downloadPeerTube-9eee32fc34ece1cc5e624ae15d81bfede68be33f.tar.gz
PeerTube-9eee32fc34ece1cc5e624ae15d81bfede68be33f.tar.zst
PeerTube-9eee32fc34ece1cc5e624ae15d81bfede68be33f.zip
Client: fix update button displayed on non owned video
-rw-r--r--client/src/app/videos/shared/video.model.ts4
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts3
-rw-r--r--server/tests/api/video-abuse.js2
-rw-r--r--server/tests/api/video-blacklist.js2
4 files changed, 7 insertions, 4 deletions
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts
index 1cfb312b6..fafdb4ac4 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 {
93 return user && user.isAdmin() === true && this.isLocal === false; 93 return user && user.isAdmin() === true && this.isLocal === false;
94 } 94 }
95 95
96 isUpdatableBy(user) {
97 return user && this.isLocal === true && user.username === this.author;
98 }
99
96 isVideoNSFWForUser(user: User) { 100 isVideoNSFWForUser(user: User) {
97 // If the video is NSFW and the user is not logged in, or the user does not want to display NSFW videos... 101 // If the video is NSFW and the user is not logged in, or the user does not want to display NSFW videos...
98 return (this.nsfw && (!user || user.displayNSFW === false)); 102 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 07b2a1d1f..756f66726 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 {
229 } 229 }
230 230
231 canUserUpdateVideo() { 231 canUserUpdateVideo() {
232 return this.authService.getUser() !== null && 232 return this.video.isUpdatableBy(this.authService.getUser());
233 this.authService.getUser().username === this.video.author;
234 } 233 }
235 234
236 isVideoRemovable() { 235 isVideoRemovable() {
diff --git a/server/tests/api/video-abuse.js b/server/tests/api/video-abuse.js
index a9af74857..c2b6186bd 100644
--- a/server/tests/api/video-abuse.js
+++ b/server/tests/api/video-abuse.js
@@ -17,7 +17,7 @@ describe('Test video abuses', function () {
17 let servers = [] 17 let servers = []
18 18
19 before(function (done) { 19 before(function (done) {
20 this.timeout(30000) 20 this.timeout(40000)
21 21
22 series([ 22 series([
23 // Run servers 23 // Run servers
diff --git a/server/tests/api/video-blacklist.js b/server/tests/api/video-blacklist.js
index 6287b9b08..20b7c5de3 100644
--- a/server/tests/api/video-blacklist.js
+++ b/server/tests/api/video-blacklist.js
@@ -17,7 +17,7 @@ describe('Test video blacklists', function () {
17 let servers = [] 17 let servers = []
18 18
19 before(function (done) { 19 before(function (done) {
20 this.timeout(30000) 20 this.timeout(40000)
21 21
22 series([ 22 series([
23 // Run servers 23 // Run servers