aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-06 12:26:58 +0100
committerChocobozzz <me@florianbigard.com>2019-02-06 12:26:58 +0100
commit73471b1a52f242e86364ffb077ea6cadb3b07ae2 (patch)
tree43dbb7748e281f8d80f15326f489cdea10ec857d /shared/models/users
parentc22419dd265c0c7185bf4197a1cb286eb3d8ebc0 (diff)
parentf5305c04aae14467d6f957b713c5a902275cbb89 (diff)
downloadPeerTube-73471b1a52f242e86364ffb077ea6cadb3b07ae2.tar.gz
PeerTube-73471b1a52f242e86364ffb077ea6cadb3b07ae2.tar.zst
PeerTube-73471b1a52f242e86364ffb077ea6cadb3b07ae2.zip
Merge branch 'release/v1.2.0'
Diffstat (limited to 'shared/models/users')
-rw-r--r--shared/models/users/index.ts2
-rw-r--r--shared/models/users/user-notification-setting.model.ts17
-rw-r--r--shared/models/users/user-notification.model.ts83
-rw-r--r--shared/models/users/user-right.enum.ts5
-rw-r--r--shared/models/users/user-role.ts3
-rw-r--r--shared/models/users/user-update-me.model.ts7
-rw-r--r--shared/models/users/user.model.ts6
7 files changed, 120 insertions, 3 deletions
diff --git a/shared/models/users/index.ts b/shared/models/users/index.ts
index 7114741e0..cd07cf320 100644
--- a/shared/models/users/index.ts
+++ b/shared/models/users/index.ts
@@ -1,6 +1,8 @@
1export * from './user.model' 1export * from './user.model'
2export * from './user-create.model' 2export * from './user-create.model'
3export * from './user-login.model' 3export * from './user-login.model'
4export * from './user-notification.model'
5export * from './user-notification-setting.model'
4export * from './user-refresh-token.model' 6export * from './user-refresh-token.model'
5export * from './user-update.model' 7export * from './user-update.model'
6export * from './user-update-me.model' 8export * from './user-update-me.model'
diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts
new file mode 100644
index 000000000..531e12bba
--- /dev/null
+++ b/shared/models/users/user-notification-setting.model.ts
@@ -0,0 +1,17 @@
1export enum UserNotificationSettingValue {
2 NONE = 0,
3 WEB = 1 << 0,
4 EMAIL = 1 << 1
5}
6
7export interface UserNotificationSetting {
8 newVideoFromSubscription: UserNotificationSettingValue
9 newCommentOnMyVideo: UserNotificationSettingValue
10 videoAbuseAsModerator: UserNotificationSettingValue
11 blacklistOnMyVideo: UserNotificationSettingValue
12 myVideoPublished: UserNotificationSettingValue
13 myVideoImportFinished: UserNotificationSettingValue
14 newUserRegistration: UserNotificationSettingValue
15 newFollow: UserNotificationSettingValue
16 commentMention: UserNotificationSettingValue
17}
diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts
new file mode 100644
index 000000000..186b62612
--- /dev/null
+++ b/shared/models/users/user-notification.model.ts
@@ -0,0 +1,83 @@
1export enum UserNotificationType {
2 NEW_VIDEO_FROM_SUBSCRIPTION = 1,
3 NEW_COMMENT_ON_MY_VIDEO = 2,
4 NEW_VIDEO_ABUSE_FOR_MODERATORS = 3,
5
6 BLACKLIST_ON_MY_VIDEO = 4,
7 UNBLACKLIST_ON_MY_VIDEO = 5,
8
9 MY_VIDEO_PUBLISHED = 6,
10
11 MY_VIDEO_IMPORT_SUCCESS = 7,
12 MY_VIDEO_IMPORT_ERROR = 8,
13
14 NEW_USER_REGISTRATION = 9,
15 NEW_FOLLOW = 10,
16 COMMENT_MENTION = 11
17}
18
19export interface VideoInfo {
20 id: number
21 uuid: string
22 name: string
23}
24
25export interface ActorInfo {
26 id: number
27 displayName: string
28 name: string
29 host: string
30 avatar?: {
31 path: string
32 }
33}
34
35export interface UserNotification {
36 id: number
37 type: UserNotificationType
38 read: boolean
39
40 video?: VideoInfo & {
41 channel: ActorInfo
42 }
43
44 videoImport?: {
45 id: number
46 video?: VideoInfo
47 torrentName?: string
48 magnetUri?: string
49 targetUrl?: string
50 }
51
52 comment?: {
53 id: number
54 threadId: number
55 account: ActorInfo
56 video: VideoInfo
57 }
58
59 videoAbuse?: {
60 id: number
61 video: VideoInfo
62 }
63
64 videoBlacklist?: {
65 id: number
66 video: VideoInfo
67 }
68
69 account?: ActorInfo
70
71 actorFollow?: {
72 id: number
73 follower: ActorInfo
74 following: {
75 type: 'account' | 'channel'
76 name: string
77 displayName: string
78 }
79 }
80
81 createdAt: string
82 updatedAt: string
83}
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts
index 51c59d20a..090256bca 100644
--- a/shared/models/users/user-right.enum.ts
+++ b/shared/models/users/user-right.enum.ts
@@ -2,10 +2,15 @@ export enum UserRight {
2 ALL, 2 ALL,
3 3
4 MANAGE_USERS, 4 MANAGE_USERS,
5
5 MANAGE_SERVER_FOLLOW, 6 MANAGE_SERVER_FOLLOW,
7
6 MANAGE_SERVER_REDUNDANCY, 8 MANAGE_SERVER_REDUNDANCY,
9
7 MANAGE_VIDEO_ABUSES, 10 MANAGE_VIDEO_ABUSES,
11
8 MANAGE_JOBS, 12 MANAGE_JOBS,
13
9 MANAGE_CONFIGURATION, 14 MANAGE_CONFIGURATION,
10 15
11 MANAGE_ACCOUNTS_BLOCKLIST, 16 MANAGE_ACCOUNTS_BLOCKLIST,
diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts
index adef8fd95..59c2ba106 100644
--- a/shared/models/users/user-role.ts
+++ b/shared/models/users/user-role.ts
@@ -29,7 +29,8 @@ const userRoleRights: { [ id: number ]: UserRight[] } = {
29 UserRight.UPDATE_ANY_VIDEO, 29 UserRight.UPDATE_ANY_VIDEO,
30 UserRight.SEE_ALL_VIDEOS, 30 UserRight.SEE_ALL_VIDEOS,
31 UserRight.MANAGE_ACCOUNTS_BLOCKLIST, 31 UserRight.MANAGE_ACCOUNTS_BLOCKLIST,
32 UserRight.MANAGE_SERVERS_BLOCKLIST 32 UserRight.MANAGE_SERVERS_BLOCKLIST,
33 UserRight.MANAGE_USERS
33 ], 34 ],
34 35
35 [UserRole.USER]: [] 36 [UserRole.USER]: []
diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts
index 10edeee2e..e24afab94 100644
--- a/shared/models/users/user-update-me.model.ts
+++ b/shared/models/users/user-update-me.model.ts
@@ -3,9 +3,12 @@ import { NSFWPolicyType } from '../videos/nsfw-policy.type'
3export interface UserUpdateMe { 3export interface UserUpdateMe {
4 displayName?: string 4 displayName?: string
5 description?: string 5 description?: string
6 nsfwPolicy?: NSFWPolicyType, 6 nsfwPolicy?: NSFWPolicyType
7 webTorrentEnabled?: boolean, 7
8 webTorrentEnabled?: boolean
8 autoPlayVideo?: boolean 9 autoPlayVideo?: boolean
10 videosHistoryEnabled?: boolean
11
9 email?: string 12 email?: string
10 currentPassword?: string 13 currentPassword?: string
11 password?: string 14 password?: string
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts
index 82af17516..af783d389 100644
--- a/shared/models/users/user.model.ts
+++ b/shared/models/users/user.model.ts
@@ -2,6 +2,7 @@ import { Account } from '../actors'
2import { VideoChannel } from '../videos/channel/video-channel.model' 2import { VideoChannel } from '../videos/channel/video-channel.model'
3import { UserRole } from './user-role' 3import { UserRole } from './user-role'
4import { NSFWPolicyType } from '../videos/nsfw-policy.type' 4import { NSFWPolicyType } from '../videos/nsfw-policy.type'
5import { UserNotificationSetting } from './user-notification-setting.model'
5 6
6export interface User { 7export interface User {
7 id: number 8 id: number
@@ -9,12 +10,17 @@ export interface User {
9 email: string 10 email: string
10 emailVerified: boolean 11 emailVerified: boolean
11 nsfwPolicy: NSFWPolicyType 12 nsfwPolicy: NSFWPolicyType
13
12 autoPlayVideo: boolean 14 autoPlayVideo: boolean
15 webTorrentEnabled: boolean
16 videosHistoryEnabled: boolean
17
13 role: UserRole 18 role: UserRole
14 videoQuota: number 19 videoQuota: number
15 videoQuotaDaily: number 20 videoQuotaDaily: number
16 createdAt: Date 21 createdAt: Date
17 account: Account 22 account: Account
23 notificationSettings?: UserNotificationSetting
18 videoChannels?: VideoChannel[] 24 videoChannels?: VideoChannel[]
19 25
20 blocked: boolean 26 blocked: boolean