parent
815917c3d1
commit
1ad0eec00d
3 changed files with 22 additions and 9 deletions
|
@ -138,7 +138,7 @@ export async function packActivity(note: Note): Promise<any> {
|
||||||
) {
|
) {
|
||||||
const renote = await Notes.findOneByOrFail({ id: note.renoteId });
|
const renote = await Notes.findOneByOrFail({ id: note.renoteId });
|
||||||
return renderAnnounce(
|
return renderAnnounce(
|
||||||
renote.uri ?? `${config.url}/notes/${renote.id}`,
|
renote.uri ? renote.uri : `${config.url}/notes/${renote.id}`,
|
||||||
note,
|
note,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,6 @@ import { shouldSilenceInstance } from "@/misc/should-block-instance.js";
|
||||||
import meilisearch from "../../db/meilisearch.js";
|
import meilisearch from "../../db/meilisearch.js";
|
||||||
import { redisClient } from "@/db/redis.js";
|
import { redisClient } from "@/db/redis.js";
|
||||||
import { Mutex } from "redis-semaphore";
|
import { Mutex } from "redis-semaphore";
|
||||||
import { packActivity } from "@/server/activitypub/outbox.js";
|
|
||||||
|
|
||||||
const mutedWordsCache = new Cache<
|
const mutedWordsCache = new Cache<
|
||||||
{ userId: UserProfile["userId"]; mutedWords: UserProfile["mutedWords"] }[]
|
{ userId: UserProfile["userId"]; mutedWords: UserProfile["mutedWords"] }[]
|
||||||
|
@ -597,13 +596,9 @@ export default async (
|
||||||
});
|
});
|
||||||
|
|
||||||
//#region AP deliver
|
//#region AP deliver
|
||||||
if (
|
if (Users.isLocalUser(user) && !dontFederateInitially) {
|
||||||
Users.isLocalUser(user) &&
|
|
||||||
!data.localOnly &&
|
|
||||||
!dontFederateInitially
|
|
||||||
) {
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const noteActivity = renderActivity(await packActivity(note));
|
const noteActivity = await renderNoteOrRenoteActivity(data, note);
|
||||||
const dm = new DeliverManager(user, noteActivity);
|
const dm = new DeliverManager(user, noteActivity);
|
||||||
|
|
||||||
// メンションされたリモートユーザーに配送
|
// メンションされたリモートユーザーに配送
|
||||||
|
@ -660,6 +655,25 @@ export default async (
|
||||||
await index(note, false);
|
await index(note, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function renderNoteOrRenoteActivity(data: Option, note: Note) {
|
||||||
|
if (data.localOnly) return null;
|
||||||
|
|
||||||
|
const content =
|
||||||
|
data.renote &&
|
||||||
|
data.text == null &&
|
||||||
|
data.poll == null &&
|
||||||
|
(data.files == null || data.files.length === 0)
|
||||||
|
? renderAnnounce(
|
||||||
|
data.renote.uri
|
||||||
|
? data.renote.uri
|
||||||
|
: `${config.url}/notes/${data.renote.id}`,
|
||||||
|
note,
|
||||||
|
)
|
||||||
|
: renderCreate(await renderNote(note, false), note);
|
||||||
|
|
||||||
|
return renderActivity(content);
|
||||||
|
}
|
||||||
|
|
||||||
function incRenoteCount(renote: Note) {
|
function incRenoteCount(renote: Note) {
|
||||||
Notes.createQueryBuilder()
|
Notes.createQueryBuilder()
|
||||||
.update()
|
.update()
|
||||||
|
|
|
@ -328,7 +328,6 @@ if (noteViewInterruptors.length > 0) {
|
||||||
const isRenote =
|
const isRenote =
|
||||||
note.renote != null &&
|
note.renote != null &&
|
||||||
note.text == null &&
|
note.text == null &&
|
||||||
note.cw == null &&
|
|
||||||
note.fileIds.length === 0 &&
|
note.fileIds.length === 0 &&
|
||||||
note.poll == null;
|
note.poll == null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue