Fix cw-only renotes

Co-authored-by: Johann150 <johann@qwertqwefsday.eu>
This commit is contained in:
Laura Hausmann 2023-07-22 15:32:54 +02:00
parent 9928ca72e2
commit 11e4ef045d
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605
5 changed files with 12 additions and 5 deletions

View File

@ -133,12 +133,13 @@ export async function packActivity(note: Note): Promise<any> {
if (
note.renoteId &&
note.text == null &&
note.cw == null &&
!note.hasPoll &&
(note.fileIds == null || note.fileIds.length === 0)
) {
const renote = await Notes.findOneByOrFail({ id: note.renoteId });
return renderAnnounce(
renote.uri ? renote.uri : `${config.url}/notes/${renote.id}`,
renote.uri ?? `${config.url}/notes/${renote.id}`,
note,
);
}

View File

@ -596,7 +596,11 @@ export default async (
});
//#region AP deliver
if (Users.isLocalUser(user) && !dontFederateInitially) {
if (
Users.isLocalUser(user) &&
!data.localOnly &&
!dontFederateInitially
) {
(async () => {
const noteActivity = await renderNoteOrRenoteActivity(data, note);
const dm = new DeliverManager(user, noteActivity);
@ -661,12 +665,11 @@ async function renderNoteOrRenoteActivity(data: Option, note: Note) {
const content =
data.renote &&
data.text == null &&
data.cw == null &&
data.poll == null &&
(data.files == null || data.files.length === 0)
? renderAnnounce(
data.renote.uri
? data.renote.uri
: `${config.url}/notes/${data.renote.id}`,
data.renote.uri ?? `${config.url}/notes/${data.renote.id}`,
note,
)
: renderCreate(await renderNote(note, false), note);

View File

@ -61,6 +61,7 @@ export default async function (
if (
note.renoteId &&
note.text == null &&
note.cw == null &&
!note.hasPoll &&
(note.fileIds == null || note.fileIds.length === 0)
) {

View File

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

View File

@ -21,6 +21,7 @@ export function getNoteMenu(props: {
const isRenote =
props.note.renote != null &&
props.note.text == null &&
props.note.cw == null &&
props.note.fileIds.length === 0 &&
props.note.poll == null;