aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/models/actor/actor-image.ts3
-rw-r--r--server/models/user/sql/user-notitication-list-query-builder.ts5
-rw-r--r--server/tests/shared/notifications.ts20
3 files changed, 24 insertions, 4 deletions
diff --git a/server/models/actor/actor-image.ts b/server/models/actor/actor-image.ts
index f74ab735e..9d44ef4d1 100644
--- a/server/models/actor/actor-image.ts
+++ b/server/models/actor/actor-image.ts
@@ -138,6 +138,9 @@ export class ActorImageModel extends Model<Partial<AttributesOnly<ActorImageMode
138 138
139 case ActorImageType.BANNER: 139 case ActorImageType.BANNER:
140 return join(LAZY_STATIC_PATHS.BANNERS, this.filename) 140 return join(LAZY_STATIC_PATHS.BANNERS, this.filename)
141
142 default:
143 throw new Error('Unknown actor image type: ' + this.type)
141 } 144 }
142 } 145 }
143 146
diff --git a/server/models/user/sql/user-notitication-list-query-builder.ts b/server/models/user/sql/user-notitication-list-query-builder.ts
index 6a6a71e3a..31b4932bf 100644
--- a/server/models/user/sql/user-notitication-list-query-builder.ts
+++ b/server/models/user/sql/user-notitication-list-query-builder.ts
@@ -86,6 +86,7 @@ export class UserNotificationListQueryBuilder extends AbstractRunQuery {
86 "Video->VideoChannel->Actor"."preferredUsername" AS "Video.VideoChannel.Actor.preferredUsername", 86 "Video->VideoChannel->Actor"."preferredUsername" AS "Video.VideoChannel.Actor.preferredUsername",
87 "Video->VideoChannel->Actor->Avatars"."id" AS "Video.VideoChannel.Actor.Avatars.id", 87 "Video->VideoChannel->Actor->Avatars"."id" AS "Video.VideoChannel.Actor.Avatars.id",
88 "Video->VideoChannel->Actor->Avatars"."width" AS "Video.VideoChannel.Actor.Avatars.width", 88 "Video->VideoChannel->Actor->Avatars"."width" AS "Video.VideoChannel.Actor.Avatars.width",
89 "Video->VideoChannel->Actor->Avatars"."type" AS "Video.VideoChannel.Actor.Avatars.type",
89 "Video->VideoChannel->Actor->Avatars"."filename" AS "Video.VideoChannel.Actor.Avatars.filename", 90 "Video->VideoChannel->Actor->Avatars"."filename" AS "Video.VideoChannel.Actor.Avatars.filename",
90 "Video->VideoChannel->Actor->Server"."id" AS "Video.VideoChannel.Actor.Server.id", 91 "Video->VideoChannel->Actor->Server"."id" AS "Video.VideoChannel.Actor.Server.id",
91 "Video->VideoChannel->Actor->Server"."host" AS "Video.VideoChannel.Actor.Server.host", 92 "Video->VideoChannel->Actor->Server"."host" AS "Video.VideoChannel.Actor.Server.host",
@@ -97,6 +98,7 @@ export class UserNotificationListQueryBuilder extends AbstractRunQuery {
97 "VideoComment->Account->Actor"."preferredUsername" AS "VideoComment.Account.Actor.preferredUsername", 98 "VideoComment->Account->Actor"."preferredUsername" AS "VideoComment.Account.Actor.preferredUsername",
98 "VideoComment->Account->Actor->Avatars"."id" AS "VideoComment.Account.Actor.Avatars.id", 99 "VideoComment->Account->Actor->Avatars"."id" AS "VideoComment.Account.Actor.Avatars.id",
99 "VideoComment->Account->Actor->Avatars"."width" AS "VideoComment.Account.Actor.Avatars.width", 100 "VideoComment->Account->Actor->Avatars"."width" AS "VideoComment.Account.Actor.Avatars.width",
101 "VideoComment->Account->Actor->Avatars"."type" AS "VideoComment.Account.Actor.Avatars.type",
100 "VideoComment->Account->Actor->Avatars"."filename" AS "VideoComment.Account.Actor.Avatars.filename", 102 "VideoComment->Account->Actor->Avatars"."filename" AS "VideoComment.Account.Actor.Avatars.filename",
101 "VideoComment->Account->Actor->Server"."id" AS "VideoComment.Account.Actor.Server.id", 103 "VideoComment->Account->Actor->Server"."id" AS "VideoComment.Account.Actor.Server.id",
102 "VideoComment->Account->Actor->Server"."host" AS "VideoComment.Account.Actor.Server.host", 104 "VideoComment->Account->Actor->Server"."host" AS "VideoComment.Account.Actor.Server.host",
@@ -127,6 +129,7 @@ export class UserNotificationListQueryBuilder extends AbstractRunQuery {
127 "Abuse->FlaggedAccount->Actor"."preferredUsername" AS "Abuse.FlaggedAccount.Actor.preferredUsername", 129 "Abuse->FlaggedAccount->Actor"."preferredUsername" AS "Abuse.FlaggedAccount.Actor.preferredUsername",
128 "Abuse->FlaggedAccount->Actor->Avatars"."id" AS "Abuse.FlaggedAccount.Actor.Avatars.id", 130 "Abuse->FlaggedAccount->Actor->Avatars"."id" AS "Abuse.FlaggedAccount.Actor.Avatars.id",
129 "Abuse->FlaggedAccount->Actor->Avatars"."width" AS "Abuse.FlaggedAccount.Actor.Avatars.width", 131 "Abuse->FlaggedAccount->Actor->Avatars"."width" AS "Abuse.FlaggedAccount.Actor.Avatars.width",
132 "Abuse->FlaggedAccount->Actor->Avatars"."type" AS "Abuse.FlaggedAccount.Actor.Avatars.type",
130 "Abuse->FlaggedAccount->Actor->Avatars"."filename" AS "Abuse.FlaggedAccount.Actor.Avatars.filename", 133 "Abuse->FlaggedAccount->Actor->Avatars"."filename" AS "Abuse.FlaggedAccount.Actor.Avatars.filename",
131 "Abuse->FlaggedAccount->Actor->Server"."id" AS "Abuse.FlaggedAccount.Actor.Server.id", 134 "Abuse->FlaggedAccount->Actor->Server"."id" AS "Abuse.FlaggedAccount.Actor.Server.id",
132 "Abuse->FlaggedAccount->Actor->Server"."host" AS "Abuse.FlaggedAccount.Actor.Server.host", 135 "Abuse->FlaggedAccount->Actor->Server"."host" AS "Abuse.FlaggedAccount.Actor.Server.host",
@@ -155,6 +158,7 @@ export class UserNotificationListQueryBuilder extends AbstractRunQuery {
155 "ActorFollow->ActorFollower->Account"."name" AS "ActorFollow.ActorFollower.Account.name", 158 "ActorFollow->ActorFollower->Account"."name" AS "ActorFollow.ActorFollower.Account.name",
156 "ActorFollow->ActorFollower->Avatars"."id" AS "ActorFollow.ActorFollower.Avatars.id", 159 "ActorFollow->ActorFollower->Avatars"."id" AS "ActorFollow.ActorFollower.Avatars.id",
157 "ActorFollow->ActorFollower->Avatars"."width" AS "ActorFollow.ActorFollower.Avatars.width", 160 "ActorFollow->ActorFollower->Avatars"."width" AS "ActorFollow.ActorFollower.Avatars.width",
161 "ActorFollow->ActorFollower->Avatars"."type" AS "ActorFollow.ActorFollower.Avatars.type",
158 "ActorFollow->ActorFollower->Avatars"."filename" AS "ActorFollow.ActorFollower.Avatars.filename", 162 "ActorFollow->ActorFollower->Avatars"."filename" AS "ActorFollow.ActorFollower.Avatars.filename",
159 "ActorFollow->ActorFollower->Server"."id" AS "ActorFollow.ActorFollower.Server.id", 163 "ActorFollow->ActorFollower->Server"."id" AS "ActorFollow.ActorFollower.Server.id",
160 "ActorFollow->ActorFollower->Server"."host" AS "ActorFollow.ActorFollower.Server.host", 164 "ActorFollow->ActorFollower->Server"."host" AS "ActorFollow.ActorFollower.Server.host",
@@ -173,6 +177,7 @@ export class UserNotificationListQueryBuilder extends AbstractRunQuery {
173 "Account->Actor"."preferredUsername" AS "Account.Actor.preferredUsername", 177 "Account->Actor"."preferredUsername" AS "Account.Actor.preferredUsername",
174 "Account->Actor->Avatars"."id" AS "Account.Actor.Avatars.id", 178 "Account->Actor->Avatars"."id" AS "Account.Actor.Avatars.id",
175 "Account->Actor->Avatars"."width" AS "Account.Actor.Avatars.width", 179 "Account->Actor->Avatars"."width" AS "Account.Actor.Avatars.width",
180 "Account->Actor->Avatars"."type" AS "Account.Actor.Avatars.type",
176 "Account->Actor->Avatars"."filename" AS "Account.Actor.Avatars.filename", 181 "Account->Actor->Avatars"."filename" AS "Account.Actor.Avatars.filename",
177 "Account->Actor->Server"."id" AS "Account.Actor.Server.id", 182 "Account->Actor->Server"."id" AS "Account.Actor.Server.id",
178 "Account->Actor->Server"."host" AS "Account.Actor.Server.host"` 183 "Account->Actor->Server"."host" AS "Account.Actor.Server.host"`
diff --git a/server/tests/shared/notifications.ts b/server/tests/shared/notifications.ts
index a62410880..09bc8da03 100644
--- a/server/tests/shared/notifications.ts
+++ b/server/tests/shared/notifications.ts
@@ -185,7 +185,7 @@ async function checkUserRegistered (options: CheckerBaseParams & {
185 expect(notification).to.not.be.undefined 185 expect(notification).to.not.be.undefined
186 expect(notification.type).to.equal(notificationType) 186 expect(notification.type).to.equal(notificationType)
187 187
188 checkActor(notification.account) 188 checkActor(notification.account, { withAvatar: false })
189 expect(notification.account.name).to.equal(username) 189 expect(notification.account.name).to.equal(username)
190 } else { 190 } else {
191 expect(notification).to.satisfy(n => n.type !== notificationType || n.account.name !== username) 191 expect(notification).to.satisfy(n => n.type !== notificationType || n.account.name !== username)
@@ -253,7 +253,7 @@ async function checkNewInstanceFollower (options: CheckerBaseParams & {
253 expect(notification).to.not.be.undefined 253 expect(notification).to.not.be.undefined
254 expect(notification.type).to.equal(notificationType) 254 expect(notification.type).to.equal(notificationType)
255 255
256 checkActor(notification.actorFollow.follower) 256 checkActor(notification.actorFollow.follower, { withAvatar: false })
257 expect(notification.actorFollow.follower.name).to.equal('peertube') 257 expect(notification.actorFollow.follower.name).to.equal('peertube')
258 expect(notification.actorFollow.follower.host).to.equal(followerHost) 258 expect(notification.actorFollow.follower.host).to.equal(followerHost)
259 259
@@ -288,7 +288,8 @@ async function checkAutoInstanceFollowing (options: CheckerBaseParams & {
288 expect(notification.type).to.equal(notificationType) 288 expect(notification.type).to.equal(notificationType)
289 289
290 const following = notification.actorFollow.following 290 const following = notification.actorFollow.following
291 checkActor(following) 291
292 checkActor(following, { withAvatar: false })
292 expect(following.name).to.equal('peertube') 293 expect(following.name).to.equal('peertube')
293 expect(following.host).to.equal(followingHost) 294 expect(following.host).to.equal(followingHost)
294 295
@@ -701,6 +702,9 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: an
701 const userAccessToken = await servers[0].login.getAccessToken(user) 702 const userAccessToken = await servers[0].login.getAccessToken(user)
702 703
703 await servers[0].notifications.updateMySettings({ token: userAccessToken, settings: getAllNotificationsSettings() }) 704 await servers[0].notifications.updateMySettings({ token: userAccessToken, settings: getAllNotificationsSettings() })
705 await servers[0].users.updateMyAvatar({ token: userAccessToken, fixture: 'avatar.png' })
706 await servers[0].channels.updateImage({ channelName: 'user_1_channel', token: userAccessToken, fixture: 'avatar.png', type: 'avatar' })
707
704 await servers[0].notifications.updateMySettings({ settings: getAllNotificationsSettings() }) 708 await servers[0].notifications.updateMySettings({ settings: getAllNotificationsSettings() })
705 709
706 if (serversCount > 1) { 710 if (serversCount > 1) {
@@ -832,10 +836,18 @@ function checkVideo (video: any, videoName?: string, shortUUID?: string) {
832 expect(video.id).to.be.a('number') 836 expect(video.id).to.be.a('number')
833} 837}
834 838
835function checkActor (actor: any) { 839function checkActor (actor: any, options: { withAvatar?: boolean } = {}) {
840 const { withAvatar = true } = options
841
836 expect(actor.displayName).to.be.a('string') 842 expect(actor.displayName).to.be.a('string')
837 expect(actor.displayName).to.not.be.empty 843 expect(actor.displayName).to.not.be.empty
838 expect(actor.host).to.not.be.undefined 844 expect(actor.host).to.not.be.undefined
845
846 if (withAvatar) {
847 expect(actor.avatars).to.be.an('array')
848 expect(actor.avatars).to.have.lengthOf(2)
849 expect(actor.avatars[0].path).to.exist.and.not.empty
850 }
839} 851}
840 852
841function checkComment (comment: any, commentId: number, threadId: number) { 853function checkComment (comment: any, commentId: number, threadId: number) {