diff options
Diffstat (limited to 'server/models/account/user-notification-setting.ts')
-rw-r--r-- | server/models/account/user-notification-setting.ts | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/server/models/account/user-notification-setting.ts b/server/models/account/user-notification-setting.ts index d8f3f13da..acc192d53 100644 --- a/server/models/account/user-notification-setting.ts +++ b/server/models/account/user-notification-setting.ts | |||
@@ -12,12 +12,12 @@ import { | |||
12 | Table, | 12 | Table, |
13 | UpdatedAt | 13 | UpdatedAt |
14 | } from 'sequelize-typescript' | 14 | } from 'sequelize-typescript' |
15 | import { throwIfNotValid } from '../utils' | 15 | import { MNotificationSettingFormattable } from '@server/types/models' |
16 | import { UserModel } from './user' | ||
17 | import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications' | ||
18 | import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model' | 16 | import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model' |
17 | import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications' | ||
19 | import { clearCacheByUserId } from '../../lib/oauth-model' | 18 | import { clearCacheByUserId } from '../../lib/oauth-model' |
20 | import { MNotificationSettingFormattable } from '@server/types/models' | 19 | import { throwIfNotValid } from '../utils' |
20 | import { UserModel } from './user' | ||
21 | 21 | ||
22 | @Table({ | 22 | @Table({ |
23 | tableName: 'userNotificationSetting', | 23 | tableName: 'userNotificationSetting', |
@@ -138,6 +138,24 @@ export class UserNotificationSettingModel extends Model<UserNotificationSettingM | |||
138 | @Column | 138 | @Column |
139 | commentMention: UserNotificationSettingValue | 139 | commentMention: UserNotificationSettingValue |
140 | 140 | ||
141 | @AllowNull(false) | ||
142 | @Default(null) | ||
143 | @Is( | ||
144 | 'UserNotificationSettingAbuseStateChange', | ||
145 | value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseStateChange') | ||
146 | ) | ||
147 | @Column | ||
148 | abuseStateChange: UserNotificationSettingValue | ||
149 | |||
150 | @AllowNull(false) | ||
151 | @Default(null) | ||
152 | @Is( | ||
153 | 'UserNotificationSettingAbuseNewMessage', | ||
154 | value => throwIfNotValid(value, isUserNotificationSettingValid, 'abuseNewMessage') | ||
155 | ) | ||
156 | @Column | ||
157 | abuseNewMessage: UserNotificationSettingValue | ||
158 | |||
141 | @ForeignKey(() => UserModel) | 159 | @ForeignKey(() => UserModel) |
142 | @Column | 160 | @Column |
143 | userId: number | 161 | userId: number |
@@ -175,7 +193,9 @@ export class UserNotificationSettingModel extends Model<UserNotificationSettingM | |||
175 | commentMention: this.commentMention, | 193 | commentMention: this.commentMention, |
176 | newFollow: this.newFollow, | 194 | newFollow: this.newFollow, |
177 | newInstanceFollower: this.newInstanceFollower, | 195 | newInstanceFollower: this.newInstanceFollower, |
178 | autoInstanceFollowing: this.autoInstanceFollowing | 196 | autoInstanceFollowing: this.autoInstanceFollowing, |
197 | abuseNewMessage: this.abuseNewMessage, | ||
198 | abuseStateChange: this.abuseStateChange | ||
179 | } | 199 | } |
180 | } | 200 | } |
181 | } | 201 | } |