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
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,
newUserRegistration: this.newUserRegistration,
commentMention: this.commentMention,
newFollow: this.newFollow,
- newInstanceFollower: this.newInstanceFollower
+ newInstanceFollower: this.newInstanceFollower,
+ autoInstanceFollowing: this.autoInstanceFollowing
}
}
}