fix: 🐛 fix quotes with CW-only quotes

This commit is contained in:
Johann150 2023-07-06 12:46:19 -07:00 committed by ThatOneCalculator
parent fa19b64901
commit f9b3951c3a
3 changed files with 9 additions and 22 deletions

View file

@ -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 ? renote.uri : `${config.url}/notes/${renote.id}`, renote.uri ?? `${config.url}/notes/${renote.id}`,
note, note,
); );
} }

View file

@ -67,6 +67,7 @@ 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"] }[]
@ -596,9 +597,13 @@ export default async (
}); });
//#region AP deliver //#region AP deliver
if (Users.isLocalUser(user) && !dontFederateInitially) { if (
Users.isLocalUser(user) &&
!data.localOnly &&
!dontFederateInitially
) {
(async () => { (async () => {
const noteActivity = await renderNoteOrRenoteActivity(data, note); const noteActivity = renderActivity(await packActivity(note));
const dm = new DeliverManager(user, noteActivity); const dm = new DeliverManager(user, noteActivity);
// メンションされたリモートユーザーに配送 // メンションされたリモートユーザーに配送
@ -655,25 +660,6 @@ 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()

View file

@ -328,6 +328,7 @@ 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;