revert fix: 🐛 fix quotes with CW-only quotes
This commit is contained in:
Kainoa Kanter 2023-07-06 21:53:44 +00:00
parent 815917c3d1
commit 1ad0eec00d
3 changed files with 22 additions and 9 deletions

View file

@ -138,7 +138,7 @@ export async function packActivity(note: Note): Promise<any> {
) {
const renote = await Notes.findOneByOrFail({ id: note.renoteId });
return renderAnnounce(
renote.uri ?? `${config.url}/notes/${renote.id}`,
renote.uri ? renote.uri : `${config.url}/notes/${renote.id}`,
note,
);
}

View file

@ -67,7 +67,6 @@ import { shouldSilenceInstance } from "@/misc/should-block-instance.js";
import meilisearch from "../../db/meilisearch.js";
import { redisClient } from "@/db/redis.js";
import { Mutex } from "redis-semaphore";
import { packActivity } from "@/server/activitypub/outbox.js";
const mutedWordsCache = new Cache<
{ userId: UserProfile["userId"]; mutedWords: UserProfile["mutedWords"] }[]
@ -597,13 +596,9 @@ export default async (
});
//#region AP deliver
if (
Users.isLocalUser(user) &&
!data.localOnly &&
!dontFederateInitially
) {
if (Users.isLocalUser(user) && !dontFederateInitially) {
(async () => {
const noteActivity = renderActivity(await packActivity(note));
const noteActivity = await renderNoteOrRenoteActivity(data, note);
const dm = new DeliverManager(user, noteActivity);
// メンションされたリモートユーザーに配送
@ -660,6 +655,25 @@ export default async (
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) {
Notes.createQueryBuilder()
.update()

View file

@ -328,7 +328,6 @@ if (noteViewInterruptors.length > 0) {
const isRenote =
note.renote != null &&
note.text == null &&
note.cw == null &&
note.fileIds.length === 0 &&
note.poll == null;