diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/package.json | 2 | ||||
-rw-r--r-- | client/src/app/+admin/moderation/moderation.routes.ts | 2 | ||||
-rw-r--r-- | client/src/app/menu/menu.component.html | 4 | ||||
-rw-r--r-- | client/src/app/menu/menu.component.scss | 7 | ||||
-rw-r--r-- | client/src/app/shared/users/user-notification.model.ts | 140 |
5 files changed, 82 insertions, 73 deletions
diff --git a/client/package.json b/client/package.json index 31fc77887..bc06fbd1c 100644 --- a/client/package.json +++ b/client/package.json | |||
@@ -1,6 +1,6 @@ | |||
1 | { | 1 | { |
2 | "name": "peertube-client", | 2 | "name": "peertube-client", |
3 | "version": "1.2.0", | 3 | "version": "1.2.1", |
4 | "private": true, | 4 | "private": true, |
5 | "licence": "GPLv3", | 5 | "licence": "GPLv3", |
6 | "author": { | 6 | "author": { |
diff --git a/client/src/app/+admin/moderation/moderation.routes.ts b/client/src/app/+admin/moderation/moderation.routes.ts index bc6dd49d5..6f6dde290 100644 --- a/client/src/app/+admin/moderation/moderation.routes.ts +++ b/client/src/app/+admin/moderation/moderation.routes.ts | |||
@@ -64,7 +64,7 @@ export const ModerationRoutes: Routes = [ | |||
64 | component: InstanceServerBlocklistComponent, | 64 | component: InstanceServerBlocklistComponent, |
65 | canActivate: [ UserRightGuard ], | 65 | canActivate: [ UserRightGuard ], |
66 | data: { | 66 | data: { |
67 | userRight: UserRight.MANAGE_SERVER_REDUNDANCY, | 67 | userRight: UserRight.MANAGE_SERVERS_BLOCKLIST, |
68 | meta: { | 68 | meta: { |
69 | title: 'Muted instances' | 69 | title: 'Muted instances' |
70 | } | 70 | } |
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html index aa5bfa9c9..1e532ec13 100644 --- a/client/src/app/menu/menu.component.html +++ b/client/src/app/menu/menu.component.html | |||
@@ -5,8 +5,8 @@ | |||
5 | <my-avatar-notification [user]="user"></my-avatar-notification> | 5 | <my-avatar-notification [user]="user"></my-avatar-notification> |
6 | 6 | ||
7 | <div class="logged-in-info"> | 7 | <div class="logged-in-info"> |
8 | <a routerLink="/my-account/settings" class="logged-in-username">{{ user.account?.displayName }}</a> | 8 | <a routerLink="/my-account/settings" class="logged-in-display-name">{{ user.account?.displayName }}</a> |
9 | <div class="logged-in-email">{{ user.username }}</div> | 9 | <div class="logged-in-username">{{ user.username }}</div> |
10 | </div> | 10 | </div> |
11 | 11 | ||
12 | <div class="logged-in-more" ngbDropdown placement="bottom-right"> | 12 | <div class="logged-in-more" ngbDropdown placement="bottom-right"> |
diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss index f30b89413..69704674a 100644 --- a/client/src/app/menu/menu.component.scss +++ b/client/src/app/menu/menu.component.scss | |||
@@ -41,8 +41,11 @@ menu { | |||
41 | 41 | ||
42 | .logged-in-info { | 42 | .logged-in-info { |
43 | flex-grow: 1; | 43 | flex-grow: 1; |
44 | white-space: nowrap; | ||
45 | overflow: hidden; | ||
46 | text-overflow: ellipsis; | ||
44 | 47 | ||
45 | .logged-in-username { | 48 | .logged-in-display-name { |
46 | font-size: 16px; | 49 | font-size: 16px; |
47 | font-weight: $font-semibold; | 50 | font-weight: $font-semibold; |
48 | color: var(--menuForegroundColor); | 51 | color: var(--menuForegroundColor); |
@@ -51,7 +54,7 @@ menu { | |||
51 | @include disable-default-a-behaviour; | 54 | @include disable-default-a-behaviour; |
52 | } | 55 | } |
53 | 56 | ||
54 | .logged-in-email { | 57 | .logged-in-username { |
55 | font-size: 13px; | 58 | font-size: 13px; |
56 | color: #C6C6C6; | 59 | color: #C6C6C6; |
57 | white-space: nowrap; | 60 | white-space: nowrap; |
diff --git a/client/src/app/shared/users/user-notification.model.ts b/client/src/app/shared/users/user-notification.model.ts index 125d2120c..5d0dc19ae 100644 --- a/client/src/app/shared/users/user-notification.model.ts +++ b/client/src/app/shared/users/user-notification.model.ts | |||
@@ -63,73 +63,79 @@ export class UserNotification implements UserNotificationServer { | |||
63 | this.type = hash.type | 63 | this.type = hash.type |
64 | this.read = hash.read | 64 | this.read = hash.read |
65 | 65 | ||
66 | this.video = hash.video | 66 | // We assume that some fields exist |
67 | if (this.video) this.setAvatarUrl(this.video.channel) | 67 | // To prevent a notification popup crash in case of bug, wrap it inside a try/catch |
68 | 68 | try { | |
69 | this.videoImport = hash.videoImport | 69 | this.video = hash.video |
70 | 70 | if (this.video) this.setAvatarUrl(this.video.channel) | |
71 | this.comment = hash.comment | 71 | |
72 | if (this.comment) this.setAvatarUrl(this.comment.account) | 72 | this.videoImport = hash.videoImport |
73 | 73 | ||
74 | this.videoAbuse = hash.videoAbuse | 74 | this.comment = hash.comment |
75 | 75 | if (this.comment) this.setAvatarUrl(this.comment.account) | |
76 | this.videoBlacklist = hash.videoBlacklist | 76 | |
77 | 77 | this.videoAbuse = hash.videoAbuse | |
78 | this.account = hash.account | 78 | |
79 | if (this.account) this.setAvatarUrl(this.account) | 79 | this.videoBlacklist = hash.videoBlacklist |
80 | 80 | ||
81 | this.actorFollow = hash.actorFollow | 81 | this.account = hash.account |
82 | if (this.actorFollow) this.setAvatarUrl(this.actorFollow.follower) | 82 | if (this.account) this.setAvatarUrl(this.account) |
83 | 83 | ||
84 | this.createdAt = hash.createdAt | 84 | this.actorFollow = hash.actorFollow |
85 | this.updatedAt = hash.updatedAt | 85 | if (this.actorFollow) this.setAvatarUrl(this.actorFollow.follower) |
86 | 86 | ||
87 | switch (this.type) { | 87 | this.createdAt = hash.createdAt |
88 | case UserNotificationType.NEW_VIDEO_FROM_SUBSCRIPTION: | 88 | this.updatedAt = hash.updatedAt |
89 | this.videoUrl = this.buildVideoUrl(this.video) | 89 | |
90 | break | 90 | switch (this.type) { |
91 | 91 | case UserNotificationType.NEW_VIDEO_FROM_SUBSCRIPTION: | |
92 | case UserNotificationType.UNBLACKLIST_ON_MY_VIDEO: | 92 | this.videoUrl = this.buildVideoUrl(this.video) |
93 | this.videoUrl = this.buildVideoUrl(this.video) | 93 | break |
94 | break | 94 | |
95 | 95 | case UserNotificationType.UNBLACKLIST_ON_MY_VIDEO: | |
96 | case UserNotificationType.NEW_COMMENT_ON_MY_VIDEO: | 96 | this.videoUrl = this.buildVideoUrl(this.video) |
97 | case UserNotificationType.COMMENT_MENTION: | 97 | break |
98 | this.accountUrl = this.buildAccountUrl(this.comment.account) | 98 | |
99 | this.commentUrl = [ this.buildVideoUrl(this.comment.video), { threadId: this.comment.threadId } ] | 99 | case UserNotificationType.NEW_COMMENT_ON_MY_VIDEO: |
100 | break | 100 | case UserNotificationType.COMMENT_MENTION: |
101 | 101 | this.accountUrl = this.buildAccountUrl(this.comment.account) | |
102 | case UserNotificationType.NEW_VIDEO_ABUSE_FOR_MODERATORS: | 102 | this.commentUrl = [ this.buildVideoUrl(this.comment.video), { threadId: this.comment.threadId } ] |
103 | this.videoAbuseUrl = '/admin/moderation/video-abuses/list' | 103 | break |
104 | this.videoUrl = this.buildVideoUrl(this.videoAbuse.video) | 104 | |
105 | break | 105 | case UserNotificationType.NEW_VIDEO_ABUSE_FOR_MODERATORS: |
106 | 106 | this.videoAbuseUrl = '/admin/moderation/video-abuses/list' | |
107 | case UserNotificationType.BLACKLIST_ON_MY_VIDEO: | 107 | this.videoUrl = this.buildVideoUrl(this.videoAbuse.video) |
108 | this.videoUrl = this.buildVideoUrl(this.videoBlacklist.video) | 108 | break |
109 | break | 109 | |
110 | 110 | case UserNotificationType.BLACKLIST_ON_MY_VIDEO: | |
111 | case UserNotificationType.MY_VIDEO_PUBLISHED: | 111 | this.videoUrl = this.buildVideoUrl(this.videoBlacklist.video) |
112 | this.videoUrl = this.buildVideoUrl(this.video) | 112 | break |
113 | break | 113 | |
114 | 114 | case UserNotificationType.MY_VIDEO_PUBLISHED: | |
115 | case UserNotificationType.MY_VIDEO_IMPORT_SUCCESS: | 115 | this.videoUrl = this.buildVideoUrl(this.video) |
116 | this.videoImportUrl = this.buildVideoImportUrl() | 116 | break |
117 | this.videoImportIdentifier = this.buildVideoImportIdentifier(this.videoImport) | 117 | |
118 | this.videoUrl = this.buildVideoUrl(this.videoImport.video) | 118 | case UserNotificationType.MY_VIDEO_IMPORT_SUCCESS: |
119 | break | 119 | this.videoImportUrl = this.buildVideoImportUrl() |
120 | 120 | this.videoImportIdentifier = this.buildVideoImportIdentifier(this.videoImport) | |
121 | case UserNotificationType.MY_VIDEO_IMPORT_ERROR: | 121 | this.videoUrl = this.buildVideoUrl(this.videoImport.video) |
122 | this.videoImportUrl = this.buildVideoImportUrl() | 122 | break |
123 | this.videoImportIdentifier = this.buildVideoImportIdentifier(this.videoImport) | 123 | |
124 | break | 124 | case UserNotificationType.MY_VIDEO_IMPORT_ERROR: |
125 | 125 | this.videoImportUrl = this.buildVideoImportUrl() | |
126 | case UserNotificationType.NEW_USER_REGISTRATION: | 126 | this.videoImportIdentifier = this.buildVideoImportIdentifier(this.videoImport) |
127 | this.accountUrl = this.buildAccountUrl(this.account) | 127 | break |
128 | break | 128 | |
129 | 129 | case UserNotificationType.NEW_USER_REGISTRATION: | |
130 | case UserNotificationType.NEW_FOLLOW: | 130 | this.accountUrl = this.buildAccountUrl(this.account) |
131 | this.accountUrl = this.buildAccountUrl(this.actorFollow.follower) | 131 | break |
132 | break | 132 | |
133 | case UserNotificationType.NEW_FOLLOW: | ||
134 | this.accountUrl = this.buildAccountUrl(this.actorFollow.follower) | ||
135 | break | ||
136 | } | ||
137 | } catch (err) { | ||
138 | console.error(err) | ||
133 | } | 139 | } |
134 | } | 140 | } |
135 | 141 | ||