Merge branch 'fix-10650' of https://github.com/kakkokari-gtyih/misskey into notification-hide-muting-user
This commit is contained in:
commit
a4ad66bd5b
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
- Fix: nodeinfoにenableMcaptchaとenableTurnstileが無いのを修正
|
- Fix: nodeinfoにenableMcaptchaとenableTurnstileが無いのを修正
|
||||||
|
- Fix: 破損した通知をクライアントに送信しないように
|
||||||
|
* 通知欄が無限にリロードされる問題が改善する可能性があります
|
||||||
|
|
||||||
## 2024.2.0
|
## 2024.2.0
|
||||||
|
|
||||||
|
|
|
@ -72,19 +72,36 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
|
|
||||||
if (options.checkValidNotifier !== false && !(await this.#isValidNotifier(notification, meId))) return null;
|
if (options.checkValidNotifier !== false && !(await this.#isValidNotifier(notification, meId))) return null;
|
||||||
|
|
||||||
const noteIfNeed = NOTE_REQUIRED_NOTIFICATION_TYPES.has(notification.type) && 'noteId' in notification ? (
|
const needsNote = NOTE_REQUIRED_NOTIFICATION_TYPES.has(notification.type) && 'noteId' in notification;
|
||||||
|
const noteIfNeed = needsNote ? (
|
||||||
hint?.packedNotes != null
|
hint?.packedNotes != null
|
||||||
? hint.packedNotes.get(notification.noteId)
|
? hint.packedNotes.get(notification.noteId)
|
||||||
: this.noteEntityService.pack(notification.noteId, { id: meId }, {
|
: this.noteEntityService.pack(notification.noteId, { id: meId }, {
|
||||||
detail: true,
|
detail: true,
|
||||||
})
|
})
|
||||||
) : undefined;
|
) : undefined;
|
||||||
const userIfNeed = 'notifierId' in notification ? (
|
// if the note has been deleted, don't show this notification
|
||||||
|
if (needsNote && !noteIfNeed) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const needsUser = 'notifierId' in notification;
|
||||||
|
const userIfNeed = needsUser ? (
|
||||||
hint?.packedUsers != null
|
hint?.packedUsers != null
|
||||||
? hint.packedUsers.get(notification.notifierId)
|
? hint.packedUsers.get(notification.notifierId)
|
||||||
: this.userEntityService.pack(notification.notifierId, { id: meId })
|
: this.userEntityService.pack(notification.notifierId, { id: meId })
|
||||||
) : undefined;
|
) : undefined;
|
||||||
const role = notification.type === 'roleAssigned' ? await this.roleEntityService.pack(notification.roleId) : undefined;
|
// if the user has been deleted, don't show this notification
|
||||||
|
if (needsUser && !userIfNeed) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const needsRole = notification.type === 'roleAssigned';
|
||||||
|
const role = needsRole ? await this.roleEntityService.pack(notification.roleId) : undefined;
|
||||||
|
// if the role has been deleted, don't show this notification
|
||||||
|
if (needsRole && !role) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return await awaitAll({
|
return await awaitAll({
|
||||||
id: notification.id,
|
id: notification.id,
|
||||||
|
@ -172,21 +189,32 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
|
|
||||||
if ( options.checkValidNotifier !== false && !(await this.#isValidNotifier(notification, meId))) return null;
|
if ( options.checkValidNotifier !== false && !(await this.#isValidNotifier(notification, meId))) return null;
|
||||||
|
|
||||||
const noteIfNeed = NOTE_REQUIRED_GROUPED_NOTIFICATION_TYPES.has(notification.type) && 'noteId' in notification ? (
|
const needsNote = NOTE_REQUIRED_GROUPED_NOTIFICATION_TYPES.has(notification.type) && 'noteId' in notification;
|
||||||
|
const noteIfNeed = needsNote ? (
|
||||||
hint?.packedNotes != null
|
hint?.packedNotes != null
|
||||||
? hint.packedNotes.get(notification.noteId)
|
? hint.packedNotes.get(notification.noteId)
|
||||||
: this.noteEntityService.pack(notification.noteId, { id: meId }, {
|
: this.noteEntityService.pack(notification.noteId, { id: meId }, {
|
||||||
detail: true,
|
detail: true,
|
||||||
})
|
})
|
||||||
) : undefined;
|
) : undefined;
|
||||||
const userIfNeed = 'notifierId' in notification ? (
|
// if the note has been deleted, don't show this notification
|
||||||
|
if (needsNote && !noteIfNeed) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const needsUser = 'notifierId' in notification;
|
||||||
|
const userIfNeed = needsUser ? (
|
||||||
hint?.packedUsers != null
|
hint?.packedUsers != null
|
||||||
? hint.packedUsers.get(notification.notifierId)
|
? hint.packedUsers.get(notification.notifierId)
|
||||||
: this.userEntityService.pack(notification.notifierId, { id: meId })
|
: this.userEntityService.pack(notification.notifierId, { id: meId })
|
||||||
) : undefined;
|
) : undefined;
|
||||||
|
// if the user has been deleted, don't show this notification
|
||||||
|
if (needsUser && !userIfNeed) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (notification.type === 'reaction:grouped') {
|
if (notification.type === 'reaction:grouped') {
|
||||||
const reactions = await Promise.all(notification.reactions.map(async reaction => {
|
const reactions = (await Promise.all(notification.reactions.map(async reaction => {
|
||||||
const user = hint?.packedUsers != null
|
const user = hint?.packedUsers != null
|
||||||
? hint.packedUsers.get(reaction.userId)!
|
? hint.packedUsers.get(reaction.userId)!
|
||||||
: await this.userEntityService.pack(reaction.userId, { id: meId });
|
: await this.userEntityService.pack(reaction.userId, { id: meId });
|
||||||
|
@ -194,7 +222,12 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
user,
|
user,
|
||||||
reaction: reaction.reaction,
|
reaction: reaction.reaction,
|
||||||
};
|
};
|
||||||
}));
|
}))).filter(r => r.user);
|
||||||
|
// if all users have been deleted, don't show this notification
|
||||||
|
if (!reactions.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return await awaitAll({
|
return await awaitAll({
|
||||||
id: notification.id,
|
id: notification.id,
|
||||||
createdAt: new Date(notification.createdAt).toISOString(),
|
createdAt: new Date(notification.createdAt).toISOString(),
|
||||||
|
@ -203,14 +236,19 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
reactions,
|
reactions,
|
||||||
});
|
});
|
||||||
} else if (notification.type === 'renote:grouped') {
|
} else if (notification.type === 'renote:grouped') {
|
||||||
const users = await Promise.all(notification.userIds.map(userId => {
|
const users = (await Promise.all(notification.userIds.map(userId => {
|
||||||
const packedUser = hint?.packedUsers != null ? hint.packedUsers.get(userId) : null;
|
const packedUser = hint?.packedUsers != null ? hint.packedUsers.get(userId) : null;
|
||||||
if (packedUser) {
|
if (packedUser) {
|
||||||
return packedUser;
|
return packedUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.userEntityService.pack(userId, { id: meId });
|
return this.userEntityService.pack(userId, { id: meId });
|
||||||
}));
|
}))).filter(u => u);
|
||||||
|
// if all users have been deleted, don't show this notification
|
||||||
|
if (!users.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return await awaitAll({
|
return await awaitAll({
|
||||||
id: notification.id,
|
id: notification.id,
|
||||||
createdAt: new Date(notification.createdAt).toISOString(),
|
createdAt: new Date(notification.createdAt).toISOString(),
|
||||||
|
@ -220,7 +258,12 @@ export class NotificationEntityService implements OnModuleInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const role = notification.type === 'roleAssigned' ? await this.roleEntityService.pack(notification.roleId) : undefined;
|
const needsRole = notification.type === 'roleAssigned';
|
||||||
|
const role = needsRole ? await this.roleEntityService.pack(notification.roleId) : undefined;
|
||||||
|
// if the role has been deleted, don't show this notification
|
||||||
|
if (needsRole && !role) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return await awaitAll({
|
return await awaitAll({
|
||||||
id: notification.id,
|
id: notification.id,
|
||||||
|
|
Loading…
Reference in New Issue