1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-18 09:35:33 +02:00

fix: review fixes for v2026.5.0 release (#17350)

* fix/perf: NotificationManager in NoteCreateService

* fix: treat skip as successful return in InboxProcessorService

* chore: remove comment

* fix: simplify ReactionPicker/EmojiPicker by importing components directly

* refactor: move filename parsing to setup in MkUploaderItems

* refactor
This commit is contained in:
かっこかり
2026-05-02 10:03:34 +09:00
committed by GitHub
parent 35d6c20828
commit 93bd9d551d
6 changed files with 95 additions and 138 deletions

View File

@@ -63,10 +63,10 @@ type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
class NotificationManager {
private notifier: { id: MiUser['id']; };
private note: MiNote;
private queue: {
private queue: Map<MiLocalUser['id'], {
target: MiLocalUser['id'];
reason: NotificationType;
}[];
}>;
constructor(
private mutingsRepository: MutingsRepository,
@@ -77,7 +77,7 @@ class NotificationManager {
) {
this.notifier = notifier;
this.note = note;
this.queue = [];
this.queue = new Map();
}
@bindThis
@@ -85,7 +85,7 @@ class NotificationManager {
// 自分自身へは通知しない
if (this.notifier.id === notifiee) return;
const exist = this.queue.find(x => x.target === notifiee);
const exist = this.queue.get(notifiee);
if (exist) {
// 「メンションされているかつ返信されている」場合は、メンションとしての通知ではなく返信としての通知にする
@@ -93,7 +93,7 @@ class NotificationManager {
exist.reason = reason;
}
} else {
this.queue.push({
this.queue.set(notifiee, {
reason: reason,
target: notifiee,
});
@@ -102,25 +102,25 @@ class NotificationManager {
@bindThis
public async notify() {
if (this.queue.length === 0) {
if (this.queue.size === 0) {
return;
}
const targetUserIds = this.queue.map(x => x.target);
let visibleUserIds: Set<string>;
let visibleUserIds: Set<MiUser['id']> | null;
switch (this.note.visibility) {
case 'public':
case 'home':
visibleUserIds = new Set(targetUserIds);
visibleUserIds = null;
break;
case 'specified':
visibleUserIds = new Set(this.note.visibleUserIds.filter(id => targetUserIds.includes(id)));
visibleUserIds = new Set(this.note.visibleUserIds);
break;
// TODO: フォロワー限定ノートにフォロワーではない人がメンションされた場合通知されるのが正しい挙動なのか確認(一部に挙動の不一致がありそう)。現状は通知されるためフィルタしない
// case 'followers': {
// const targetUserIds = this.queue.map(x => x.target);
// const followers = await this.followingsRepository.find({
// where: {
// followeeId: this.note.userId,
@@ -138,8 +138,10 @@ class NotificationManager {
break;
}
for (const x of this.queue) {
if (!visibleUserIds.has(x.target)) {
for (const x of this.queue.values()) {
const isVisibleToTarget = visibleUserIds === null || visibleUserIds.has(x.target);
if (!isVisibleToTarget) {
continue;
}