aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/user/user.ts21
1 files changed, 2 insertions, 19 deletions
diff --git a/server/models/user/user.ts b/server/models/user/user.ts
index a25551ecd..dc260e512 100644
--- a/server/models/user/user.ts
+++ b/server/models/user/user.ts
@@ -29,12 +29,11 @@ import {
29 MUserDefault, 29 MUserDefault,
30 MUserFormattable, 30 MUserFormattable,
31 MUserNotifSettingChannelDefault, 31 MUserNotifSettingChannelDefault,
32 MUserWithNotificationSetting, 32 MUserWithNotificationSetting
33 MVideoWithRights
34} from '@server/types/models' 33} from '@server/types/models'
35import { AttributesOnly } from '@shared/typescript-utils' 34import { AttributesOnly } from '@shared/typescript-utils'
36import { hasUserRight, USER_ROLE_LABELS } from '../../../shared/core-utils/users' 35import { hasUserRight, USER_ROLE_LABELS } from '../../../shared/core-utils/users'
37import { AbuseState, MyUser, UserRight, VideoPlaylistType, VideoPrivacy } from '../../../shared/models' 36import { AbuseState, MyUser, UserRight, VideoPlaylistType } from '../../../shared/models'
38import { User, UserRole } from '../../../shared/models/users' 37import { User, UserRole } from '../../../shared/models/users'
39import { UserAdminFlag } from '../../../shared/models/users/user-flag.model' 38import { UserAdminFlag } from '../../../shared/models/users/user-flag.model'
40import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type' 39import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type'
@@ -851,22 +850,6 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {
851 .then(u => u.map(u => u.username)) 850 .then(u => u.map(u => u.username))
852 } 851 }
853 852
854 canGetVideo (video: MVideoWithRights) {
855 const videoUserId = video.VideoChannel.Account.userId
856
857 if (video.isBlacklisted()) {
858 return videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
859 }
860
861 if (video.privacy === VideoPrivacy.PRIVATE) {
862 return video.VideoChannel && videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
863 }
864
865 if (video.privacy === VideoPrivacy.INTERNAL) return true
866
867 return false
868 }
869
870 hasRight (right: UserRight) { 853 hasRight (right: UserRight) {
871 return hasUserRight(this.role, right) 854 return hasUserRight(this.role, right)
872 } 855 }