fix: direct boost (#9783)

Sorry to create PR multiple times. I should have included this in #9778.

Co-authored-by: naskya <m@naskya.net>
Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9783
Co-authored-by: naskya <naskya@noreply.codeberg.org>
Co-committed-by: naskya <naskya@noreply.codeberg.org>
This commit is contained in:
naskya 2023-03-30 03:15:06 +00:00 committed by Kainoa Kanter
parent 8f67ae35f7
commit 82db61ede0

View File

@ -4,6 +4,10 @@ import type { Note } from "@/models/entities/note.js";
export default (object: any, note: Note) => { export default (object: any, note: Note) => {
const attributedTo = `${config.url}/users/${note.userId}`; const attributedTo = `${config.url}/users/${note.userId}`;
const mentions = (
JSON.parse(note.mentionedRemoteUsers) as IMentionedRemoteUsers
).map((x) => x.uri);
let to: string[] = []; let to: string[] = [];
let cc: string[] = []; let cc: string[] = [];
@ -13,9 +17,10 @@ export default (object: any, note: Note) => {
} else if (note.visibility === "home") { } else if (note.visibility === "home") {
to = [`${attributedTo}/followers`]; to = [`${attributedTo}/followers`];
cc = ["https://www.w3.org/ns/activitystreams#Public"]; cc = ["https://www.w3.org/ns/activitystreams#Public"];
} else if (note.visibility === 'followers') { } else if (note.visibility === "followers") {
to = [`${attributedTo}/followers`]; to = [`${attributedTo}/followers`];
cc = []; } else if (note.visibility === "specified") {
to = mentions;
} else { } else {
return null; return null;
} }