MUserDefault,
MUserFormattable,
MUserNotifSettingChannelDefault,
- MUserWithNotificationSetting,
- MVideoWithRights
+ MUserWithNotificationSetting
} from '@server/types/models'
import { AttributesOnly } from '@shared/typescript-utils'
import { hasUserRight, USER_ROLE_LABELS } from '../../../shared/core-utils/users'
-import { AbuseState, MyUser, UserRight, VideoPlaylistType, VideoPrivacy } from '../../../shared/models'
+import { AbuseState, MyUser, UserRight, VideoPlaylistType } from '../../../shared/models'
import { User, UserRole } from '../../../shared/models/users'
import { UserAdminFlag } from '../../../shared/models/users/user-flag.model'
import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type'
}
}
- return UserModel.count(query)
+ return UserModel.unscoped().count(query)
}
- const totalUsers = await UserModel.count()
+ const totalUsers = await UserModel.unscoped().count()
const totalDailyActiveUsers = await getActiveUsers(1)
const totalWeeklyActiveUsers = await getActiveUsers(7)
const totalMonthlyActiveUsers = await getActiveUsers(30)
.then(u => u.map(u => u.username))
}
- canGetVideo (video: MVideoWithRights) {
- const videoUserId = video.VideoChannel.Account.userId
-
- if (video.isBlacklisted()) {
- return videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
- }
-
- if (video.privacy === VideoPrivacy.PRIVATE) {
- return video.VideoChannel && videoUserId === this.id || this.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST)
- }
-
- if (video.privacy === VideoPrivacy.INTERNAL) return true
-
- return false
- }
-
hasRight (right: UserRight) {
return hasUserRight(this.role, right)
}