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 9e69f104ae
commit 49fd403474
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
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;