Client: fix update button displayed on non owned video

pull/71/head
Chocobozzz 2017-05-05 14:11:01 +02:00
parent b1ed221747
commit 9eee32fc34
4 changed files with 7 additions and 4 deletions

View 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));

View 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() {

View File

@ -17,7 +17,7 @@ describe('Test video abuses', function () {
let servers = []
before(function (done) {
this.timeout(30000)
this.timeout(40000)
series([
// Run servers

View File

@ -17,7 +17,7 @@ describe('Test video blacklists', function () {
let servers = []
before(function (done) {
this.timeout(30000)
this.timeout(40000)
series([
// Run servers