From 8b9a525a180cc9f3a98c334cc052dcfc8f36dcd4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Dec 2018 15:52:38 +0100 Subject: Add history on server side Add ability to disable, clear and list user videos history --- shared/models/users/user-update-me.model.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'shared/models/users') 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' export interface UserUpdateMe { displayName?: string description?: string - nsfwPolicy?: NSFWPolicyType, - webTorrentEnabled?: boolean, + nsfwPolicy?: NSFWPolicyType + + webTorrentEnabled?: boolean autoPlayVideo?: boolean + videosHistoryEnabled?: boolean + email?: string currentPassword?: string password?: string -- cgit v1.2.3 From 276d96529529621d5f70473990095495f2743c29 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 18 Dec 2018 11:32:37 +0100 Subject: Add ability to disable and clear history --- shared/models/users/user.model.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'shared/models/users') diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 82af17516..2aabff494 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts @@ -9,7 +9,11 @@ export interface User { email: string emailVerified: boolean nsfwPolicy: NSFWPolicyType + autoPlayVideo: boolean + webTorrentEnabled: boolean + videosHistoryEnabled: boolean + role: UserRole videoQuota: number videoQuotaDaily: number -- cgit v1.2.3 From cef534ed53e4518fe0acf581bfe880788d42fc36 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 26 Dec 2018 10:36:24 +0100 Subject: Add user notification base code --- shared/models/users/index.ts | 2 + .../users/user-notification-setting.model.ts | 13 ++++++ shared/models/users/user-notification.model.ts | 47 ++++++++++++++++++++++ shared/models/users/user.model.ts | 2 + 4 files changed, 64 insertions(+) create mode 100644 shared/models/users/user-notification-setting.model.ts create mode 100644 shared/models/users/user-notification.model.ts (limited to 'shared/models/users') 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 @@ export * from './user.model' export * from './user-create.model' export * from './user-login.model' +export * from './user-notification.model' +export * from './user-notification-setting.model' export * from './user-refresh-token.model' export * from './user-update.model' export * 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..7cecd70a2 --- /dev/null +++ b/shared/models/users/user-notification-setting.model.ts @@ -0,0 +1,13 @@ +export enum UserNotificationSettingValue { + NONE = 1, + WEB_NOTIFICATION = 2, + EMAIL = 3, + WEB_NOTIFICATION_AND_EMAIL = 4 +} + +export interface UserNotificationSetting { + newVideoFromSubscription: UserNotificationSettingValue + newCommentOnMyVideo: UserNotificationSettingValue + videoAbuseAsModerator: UserNotificationSettingValue + blacklistOnMyVideo: UserNotificationSettingValue +} diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts new file mode 100644 index 000000000..39beb2350 --- /dev/null +++ b/shared/models/users/user-notification.model.ts @@ -0,0 +1,47 @@ +export enum UserNotificationType { + NEW_VIDEO_FROM_SUBSCRIPTION = 1, + NEW_COMMENT_ON_MY_VIDEO = 2, + NEW_VIDEO_ABUSE_FOR_MODERATORS = 3, + BLACKLIST_ON_MY_VIDEO = 4, + UNBLACKLIST_ON_MY_VIDEO = 5 +} + +interface VideoInfo { + id: number + uuid: string + name: string +} + +export interface UserNotification { + id: number + type: UserNotificationType + read: boolean + + video?: VideoInfo & { + channel: { + id: number + displayName: string + } + } + + comment?: { + id: number + account: { + id: number + displayName: string + } + } + + videoAbuse?: { + id: number + video: VideoInfo + } + + videoBlacklist?: { + id: number + video: VideoInfo + } + + createdAt: string + updatedAt: string +} diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 2aabff494..af783d389 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts @@ -2,6 +2,7 @@ import { Account } from '../actors' import { VideoChannel } from '../videos/channel/video-channel.model' import { UserRole } from './user-role' import { NSFWPolicyType } from '../videos/nsfw-policy.type' +import { UserNotificationSetting } from './user-notification-setting.model' export interface User { id: number @@ -19,6 +20,7 @@ export interface User { videoQuotaDaily: number createdAt: Date account: Account + notificationSettings?: UserNotificationSetting videoChannels?: VideoChannel[] blocked: boolean -- cgit v1.2.3 From dc13348070d808d0ba3feb56a435b835c2e7e791 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 2 Jan 2019 16:37:43 +0100 Subject: Add import finished and video published notifs --- shared/models/users/user-notification-setting.model.ts | 2 ++ shared/models/users/user-notification.model.ts | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'shared/models/users') diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts index 7cecd70a2..55d351abf 100644 --- a/shared/models/users/user-notification-setting.model.ts +++ b/shared/models/users/user-notification-setting.model.ts @@ -10,4 +10,6 @@ export interface UserNotificationSetting { newCommentOnMyVideo: UserNotificationSettingValue videoAbuseAsModerator: UserNotificationSettingValue blacklistOnMyVideo: UserNotificationSettingValue + myVideoPublished: UserNotificationSettingValue + myVideoImportFinished: UserNotificationSettingValue } diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index 39beb2350..ee9ac275a 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -3,10 +3,13 @@ export enum UserNotificationType { NEW_COMMENT_ON_MY_VIDEO = 2, NEW_VIDEO_ABUSE_FOR_MODERATORS = 3, BLACKLIST_ON_MY_VIDEO = 4, - UNBLACKLIST_ON_MY_VIDEO = 5 + UNBLACKLIST_ON_MY_VIDEO = 5, + MY_VIDEO_PUBLISHED = 6, + MY_VIDEO_IMPORT_SUCCESS = 7, + MY_VIDEO_IMPORT_ERROR = 8 } -interface VideoInfo { +export interface VideoInfo { id: number uuid: string name: string @@ -24,12 +27,22 @@ export interface UserNotification { } } + videoImport?: { + id: number + video?: VideoInfo + torrentName?: string + magnetUri?: string + targetUrl?: string + } + comment?: { id: number + threadId: number account: { id: number displayName: string } + video: VideoInfo } videoAbuse?: { -- cgit v1.2.3 From f7cc67b455a12ccae9b0ea16876d166720364357 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 4 Jan 2019 08:56:20 +0100 Subject: Add new follow, mention and user registered notifs --- .../users/user-notification-setting.model.ts | 3 +++ shared/models/users/user-notification.model.ts | 24 +++++++++++++++++++++- shared/models/users/user-right.enum.ts | 5 +++++ shared/models/users/user-role.ts | 3 ++- 4 files changed, 33 insertions(+), 2 deletions(-) (limited to 'shared/models/users') diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts index 55d351abf..f580e827e 100644 --- a/shared/models/users/user-notification-setting.model.ts +++ b/shared/models/users/user-notification-setting.model.ts @@ -12,4 +12,7 @@ export interface UserNotificationSetting { blacklistOnMyVideo: UserNotificationSettingValue myVideoPublished: UserNotificationSettingValue myVideoImportFinished: UserNotificationSettingValue + newUserRegistration: UserNotificationSettingValue + newFollow: UserNotificationSettingValue + commentMention: UserNotificationSettingValue } diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index ee9ac275a..9dd4f099f 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -6,7 +6,10 @@ export enum UserNotificationType { UNBLACKLIST_ON_MY_VIDEO = 5, MY_VIDEO_PUBLISHED = 6, MY_VIDEO_IMPORT_SUCCESS = 7, - MY_VIDEO_IMPORT_ERROR = 8 + MY_VIDEO_IMPORT_ERROR = 8, + NEW_USER_REGISTRATION = 9, + NEW_FOLLOW = 10, + COMMENT_MENTION = 11 } export interface VideoInfo { @@ -55,6 +58,25 @@ export interface UserNotification { video: VideoInfo } + account?: { + id: number + displayName: string + name: string + } + + actorFollow?: { + id: number + follower: { + name: string + displayName: string + } + following: { + type: 'account' | 'channel' + name: string + displayName: string + } + } + createdAt: string updatedAt: string } 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 { ALL, MANAGE_USERS, + MANAGE_SERVER_FOLLOW, + MANAGE_SERVER_REDUNDANCY, + MANAGE_VIDEO_ABUSES, + MANAGE_JOBS, + MANAGE_CONFIGURATION, 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[] } = { UserRight.UPDATE_ANY_VIDEO, UserRight.SEE_ALL_VIDEOS, UserRight.MANAGE_ACCOUNTS_BLOCKLIST, - UserRight.MANAGE_SERVERS_BLOCKLIST + UserRight.MANAGE_SERVERS_BLOCKLIST, + UserRight.MANAGE_USERS ], [UserRole.USER]: [] -- cgit v1.2.3 From 2f1548fda32c3ba9e53913270394eedfacd55986 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 8 Jan 2019 11:26:41 +0100 Subject: Add notifications in the client --- shared/models/users/user-notification-setting.model.ts | 7 +++---- shared/models/users/user-notification.model.ts | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'shared/models/users') diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts index f580e827e..531e12bba 100644 --- a/shared/models/users/user-notification-setting.model.ts +++ b/shared/models/users/user-notification-setting.model.ts @@ -1,8 +1,7 @@ export enum UserNotificationSettingValue { - NONE = 1, - WEB_NOTIFICATION = 2, - EMAIL = 3, - WEB_NOTIFICATION_AND_EMAIL = 4 + NONE = 0, + WEB = 1 << 0, + EMAIL = 1 << 1 } export interface UserNotificationSetting { diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index 9dd4f099f..f41b6f534 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -2,11 +2,15 @@ export enum UserNotificationType { NEW_VIDEO_FROM_SUBSCRIPTION = 1, NEW_COMMENT_ON_MY_VIDEO = 2, NEW_VIDEO_ABUSE_FOR_MODERATORS = 3, + BLACKLIST_ON_MY_VIDEO = 4, UNBLACKLIST_ON_MY_VIDEO = 5, + MY_VIDEO_PUBLISHED = 6, + MY_VIDEO_IMPORT_SUCCESS = 7, MY_VIDEO_IMPORT_ERROR = 8, + NEW_USER_REGISTRATION = 9, NEW_FOLLOW = 10, COMMENT_MENTION = 11 -- cgit v1.2.3 From 457bb213b273a9b206cc5654eb085cede4e916ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 16 Jan 2019 16:05:40 +0100 Subject: Refactor how we use icons Inject them in an angular component so we can easily change their color --- shared/models/users/user-notification.model.ts | 30 +++++++++++--------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'shared/models/users') diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index f41b6f534..eaeb422df 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -22,16 +22,22 @@ export interface VideoInfo { name: string } +export interface ActorInfo { + id: number + displayName: string + name: string + avatar?: { + path: string + } +} + export interface UserNotification { id: number type: UserNotificationType read: boolean video?: VideoInfo & { - channel: { - id: number - displayName: string - } + channel: ActorInfo } videoImport?: { @@ -45,10 +51,7 @@ export interface UserNotification { comment?: { id: number threadId: number - account: { - id: number - displayName: string - } + account: ActorInfo video: VideoInfo } @@ -62,18 +65,11 @@ export interface UserNotification { video: VideoInfo } - account?: { - id: number - displayName: string - name: string - } + account?: ActorInfo actorFollow?: { id: number - follower: { - name: string - displayName: string - } + follower: ActorInfo following: { type: 'account' | 'channel' name: string -- cgit v1.2.3 From 38967f7b73cec6f6198c72d62f8d64bb88e6951c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 21 Jan 2019 13:52:46 +0100 Subject: Add server host in notification account field --- shared/models/users/user-notification.model.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'shared/models/users') diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts index eaeb422df..186b62612 100644 --- a/shared/models/users/user-notification.model.ts +++ b/shared/models/users/user-notification.model.ts @@ -26,6 +26,7 @@ export interface ActorInfo { id: number displayName: string name: string + host: string avatar?: { path: string } -- cgit v1.2.3