import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model'
import { clearCacheByUserId } from '../../lib/oauth-model'
+import { MNotificationSettingFormattable } from '@server/types/models'
@Table({
tableName: 'userNotificationSetting',
@Column
videoAbuseAsModerator: UserNotificationSettingValue
+ @AllowNull(false)
+ @Default(null)
+ @Is(
+ 'UserNotificationSettingVideoAutoBlacklistAsModerator',
+ value => throwIfNotValid(value, isUserNotificationSettingValid, 'videoAutoBlacklistAsModerator')
+ )
+ @Column
+ videoAutoBlacklistAsModerator: UserNotificationSettingValue
+
@AllowNull(false)
@Default(null)
@Is(
@Column
newUserRegistration: UserNotificationSettingValue
+ @AllowNull(false)
+ @Default(null)
+ @Is(
+ 'UserNotificationSettingNewInstanceFollower',
+ value => throwIfNotValid(value, isUserNotificationSettingValid, 'newInstanceFollower')
+ )
+ @Column
+ newInstanceFollower: UserNotificationSettingValue
+
+ @AllowNull(false)
+ @Default(null)
+ @Is(
+ 'UserNotificationSettingNewInstanceFollower',
+ value => throwIfNotValid(value, isUserNotificationSettingValid, 'autoInstanceFollowing')
+ )
+ @Column
+ autoInstanceFollowing: UserNotificationSettingValue
+
@AllowNull(false)
@Default(null)
@Is(
return clearCacheByUserId(instance.userId)
}
- toFormattedJSON (): UserNotificationSetting {
+ toFormattedJSON (this: MNotificationSettingFormattable): UserNotificationSetting {
return {
newCommentOnMyVideo: this.newCommentOnMyVideo,
newVideoFromSubscription: this.newVideoFromSubscription,
videoAbuseAsModerator: this.videoAbuseAsModerator,
+ videoAutoBlacklistAsModerator: this.videoAutoBlacklistAsModerator,
blacklistOnMyVideo: this.blacklistOnMyVideo,
myVideoPublished: this.myVideoPublished,
myVideoImportFinished: this.myVideoImportFinished,
newUserRegistration: this.newUserRegistration,
commentMention: this.commentMention,
- newFollow: this.newFollow
+ newFollow: this.newFollow,
+ newInstanceFollower: this.newInstanceFollower,
+ autoInstanceFollowing: this.autoInstanceFollowing
}
}
}