aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/user-notification-setting.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-07-27 16:26:25 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-07-31 11:35:19 +0200
commit594d3e48d8a887bbf48ce4cc594c1c36c9640fb1 (patch)
treebae28fa6215a3a3c6ccd78aea6ea7e75c500a96f /server/models/account/user-notification-setting.ts
parent94148c9028829b5576a5dcbfba2c7fb9cf6443d3 (diff)
downloadPeerTube-594d3e48d8a887bbf48ce4cc594c1c36c9640fb1.tar.gz
PeerTube-594d3e48d8a887bbf48ce4cc594c1c36c9640fb1.tar.zst
PeerTube-594d3e48d8a887bbf48ce4cc594c1c36c9640fb1.zip
Add abuse messages/states notifications
Diffstat (limited to 'server/models/account/user-notification-setting.ts')
-rw-r--r--server/models/account/user-notification-setting.ts30
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'
15import { throwIfNotValid } from '../utils' 15import { MNotificationSettingFormattable } from '@server/types/models'
16import { UserModel } from './user'
17import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
18import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model' 16import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model'
17import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
19import { clearCacheByUserId } from '../../lib/oauth-model' 18import { clearCacheByUserId } from '../../lib/oauth-model'
20import { MNotificationSettingFormattable } from '@server/types/models' 19import { throwIfNotValid } from '../utils'
20import { 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}