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 ( if (
note.renoteId && note.renoteId &&
note.text == null && note.text == null &&
note.cw == null &&
!note.hasPoll && !note.hasPoll &&
(note.fileIds == null || note.fileIds.length === 0) (note.fileIds == null || note.fileIds.length === 0)
) { ) {
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

@ -596,7 +596,11 @@ 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 = await renderNoteOrRenoteActivity(data, note);
const dm = new DeliverManager(user, noteActivity); const dm = new DeliverManager(user, noteActivity);
@ -661,12 +665,11 @@ async function renderNoteOrRenoteActivity(data: Option, note: Note) {
const content = const content =
data.renote && data.renote &&
data.text == null && data.text == null &&
data.cw == null &&
data.poll == null && data.poll == null &&
(data.files == null || data.files.length === 0) (data.files == null || data.files.length === 0)
? renderAnnounce( ? renderAnnounce(
data.renote.uri data.renote.uri ?? `${config.url}/notes/${data.renote.id}`,
? data.renote.uri
: `${config.url}/notes/${data.renote.id}`,
note, note,
) )
: renderCreate(await renderNote(note, false), note); : renderCreate(await renderNote(note, false), note);

View file

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

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;

View file

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