Client: fix update button displayed on non owned video
This commit is contained in:
parent
b1ed221747
commit
9eee32fc34
4 changed files with 7 additions and 4 deletions
|
@ -93,6 +93,10 @@ export class Video {
|
||||||
return user && user.isAdmin() === true && this.isLocal === false;
|
return user && user.isAdmin() === true && this.isLocal === false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isUpdatableBy(user) {
|
||||||
|
return user && this.isLocal === true && user.username === this.author;
|
||||||
|
}
|
||||||
|
|
||||||
isVideoNSFWForUser(user: User) {
|
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...
|
// 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));
|
return (this.nsfw && (!user || user.displayNSFW === false));
|
||||||
|
|
|
@ -229,8 +229,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
canUserUpdateVideo() {
|
canUserUpdateVideo() {
|
||||||
return this.authService.getUser() !== null &&
|
return this.video.isUpdatableBy(this.authService.getUser());
|
||||||
this.authService.getUser().username === this.video.author;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isVideoRemovable() {
|
isVideoRemovable() {
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe('Test video abuses', function () {
|
||||||
let servers = []
|
let servers = []
|
||||||
|
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
this.timeout(30000)
|
this.timeout(40000)
|
||||||
|
|
||||||
series([
|
series([
|
||||||
// Run servers
|
// Run servers
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe('Test video blacklists', function () {
|
||||||
let servers = []
|
let servers = []
|
||||||
|
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
this.timeout(30000)
|
this.timeout(40000)
|
||||||
|
|
||||||
series([
|
series([
|
||||||
// Run servers
|
// Run servers
|
||||||
|
|
Loading…
Reference in a new issue