do not notify if the target is not following
This commit is contained in:
parent
5338185605
commit
9535bbcf89
|
@ -12,6 +12,7 @@ import {
|
||||||
Notes,
|
Notes,
|
||||||
Emojis,
|
Emojis,
|
||||||
Blockings,
|
Blockings,
|
||||||
|
Followings,
|
||||||
} from "@/models/index.js";
|
} from "@/models/index.js";
|
||||||
import { IsNull, Not } from "typeorm";
|
import { IsNull, Not } from "typeorm";
|
||||||
import { perUserReactionsChart } from "@/services/chart/index.js";
|
import { perUserReactionsChart } from "@/services/chart/index.js";
|
||||||
|
@ -21,6 +22,7 @@ import deleteReaction from "./delete.js";
|
||||||
import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js";
|
import { isDuplicateKeyValueError } from "@/misc/is-duplicate-key-value-error.js";
|
||||||
import type { NoteReaction } from "@/models/entities/note-reaction.js";
|
import type { NoteReaction } from "@/models/entities/note-reaction.js";
|
||||||
import { IdentifiableError } from "@/misc/identifiable-error.js";
|
import { IdentifiableError } from "@/misc/identifiable-error.js";
|
||||||
|
import { shouldSilenceInstance } from "@/misc/should-block-instance.js";
|
||||||
|
|
||||||
export default async (
|
export default async (
|
||||||
user: { id: User["id"]; host: User["host"] },
|
user: { id: User["id"]; host: User["host"] },
|
||||||
|
@ -118,8 +120,25 @@ export default async (
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
// リアクションされたユーザーがローカルユーザーなら通知を作成
|
// Create notification if the reaction target is a local user.
|
||||||
if (note.userHost === null) {
|
if (
|
||||||
|
note.userHost === null &&
|
||||||
|
// if a local user reacted, or
|
||||||
|
(Users.isLocalUser(user) ||
|
||||||
|
// if a remote user not in a silenced instance reacted
|
||||||
|
(Users.isRemoteUser(user) &&
|
||||||
|
// if a remote user is in a silenced instance and the target is a local follower.
|
||||||
|
!(
|
||||||
|
(await shouldSilenceInstance(user.host)) &&
|
||||||
|
!(await Followings.exist({
|
||||||
|
where: {
|
||||||
|
followerId: note.userId,
|
||||||
|
followerHost: IsNull(),
|
||||||
|
followeeId: user.id,
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
)))
|
||||||
|
) {
|
||||||
createNotification(note.userId, "reaction", {
|
createNotification(note.userId, "reaction", {
|
||||||
notifierId: user.id,
|
notifierId: user.id,
|
||||||
note: note,
|
note: note,
|
||||||
|
@ -143,7 +162,7 @@ export default async (
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//#region 配信
|
//#region deliver
|
||||||
if (Users.isLocalUser(user) && !note.localOnly) {
|
if (Users.isLocalUser(user) && !note.localOnly) {
|
||||||
const content = renderActivity(await renderLike(record, note));
|
const content = renderActivity(await renderLike(record, note));
|
||||||
const dm = new DeliverManager(user, content);
|
const dm = new DeliverManager(user, content);
|
||||||
|
|
Loading…
Reference in New Issue