From 8ce1ba6e3efe0a688d6a0b57e8201cde33ad7aac Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 9 Apr 2019 10:42:07 +0200 Subject: [PATCH] Add new instance follower notification in client --- ...account-notification-preferences.component.html | 8 ++++---- .../src/app/shared/images/global-icon.component.ts | 3 ++- .../app/shared/users/user-notification.model.ts | 5 +++++ .../shared/users/user-notifications.component.html | 9 +++++++++ client/src/assets/images/global/users.html | 11 +++++++++++ client/src/assets/images/global/videos.svg | 14 -------------- server/initializers/constants.ts | 2 +- server/models/account/user-notification.ts | 2 +- 8 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 client/src/assets/images/global/users.html delete mode 100644 client/src/assets/images/global/videos.svg diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.html b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.html index 59422d682..93e294a96 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.html @@ -4,8 +4,8 @@
Email
-
- + +
{{ labelNotifications[notificationType] }}
@@ -15,5 +15,5 @@
- -
+
+
diff --git a/client/src/app/shared/images/global-icon.component.ts b/client/src/app/shared/images/global-icon.component.ts index d85f269ea..bd5b11bb0 100644 --- a/client/src/app/shared/images/global-icon.component.ts +++ b/client/src/app/shared/images/global-icon.component.ts @@ -43,7 +43,8 @@ const icons = { 'videos': require('../../../assets/images/global/videos.html'), 'folder': require('../../../assets/images/global/folder.html'), 'administration': require('../../../assets/images/menu/administration.html'), - 'subscriptions': require('../../../assets/images/menu/subscriptions.html') + 'subscriptions': require('../../../assets/images/menu/subscriptions.html'), + 'users': require('../../../assets/images/global/users.html') } export type GlobalIconName = keyof typeof icons diff --git a/client/src/app/shared/users/user-notification.model.ts b/client/src/app/shared/users/user-notification.model.ts index 76b983152..72fc3e7b4 100644 --- a/client/src/app/shared/users/user-notification.model.ts +++ b/client/src/app/shared/users/user-notification.model.ts @@ -59,6 +59,7 @@ export class UserNotification implements UserNotificationServer { accountUrl?: string videoImportIdentifier?: string videoImportUrl?: string + instanceFollowUrl?: string constructor (hash: UserNotificationServer) { this.id = hash.id @@ -141,6 +142,10 @@ export class UserNotification implements UserNotificationServer { case UserNotificationType.NEW_FOLLOW: this.accountUrl = this.buildAccountUrl(this.actorFollow.follower) break + + case UserNotificationType.NEW_INSTANCE_FOLLOWER: + this.instanceFollowUrl = '/admin/follows/followers-list' + break } } catch (err) { console.error(err) diff --git a/client/src/app/shared/users/user-notifications.component.html b/client/src/app/shared/users/user-notifications.component.html index 6d2f2750e..d27f60158 100644 --- a/client/src/app/shared/users/user-notifications.component.html +++ b/client/src/app/shared/users/user-notifications.component.html @@ -102,6 +102,15 @@ {{ notification.comment.account.displayName }} mentioned you on video {{ notification.comment.video.name }}
+ + + + +
+ Your instance has a new follower + awaiting your approval +
+
{{ notification.createdAt | myFromNow }}
diff --git a/client/src/assets/images/global/users.html b/client/src/assets/images/global/users.html new file mode 100644 index 000000000..522883785 --- /dev/null +++ b/client/src/assets/images/global/users.html @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/client/src/assets/images/global/videos.svg b/client/src/assets/images/global/videos.svg deleted file mode 100644 index 6e37f466f..000000000 --- a/client/src/assets/images/global/videos.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 7d9ffc668..78dd7cb9d 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -18,7 +18,7 @@ let config: IConfig = require('config') // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 355 +const LAST_MIGRATION_VERSION = 360 // --------------------------------------------------------------------------- diff --git a/server/models/account/user-notification.ts b/server/models/account/user-notification.ts index ccf8277ab..33480f3b5 100644 --- a/server/models/account/user-notification.ts +++ b/server/models/account/user-notification.ts @@ -119,7 +119,7 @@ function buildAccountInclude (required: boolean, withActor = false) { }, { - attributes: [ 'id' ], + attributes: [ 'id', 'state' ], model: () => ActorFollowModel.unscoped(), required: false, include: [ -- 2.41.0