mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 22:17:30 -07:00
Fix Announce Activity
This commit is contained in:
parent
86d4c49a95
commit
63a6e0a24d
3 changed files with 20 additions and 8 deletions
|
@ -40,11 +40,13 @@ export default async function(resolver: Resolver, actor: IRemoteUser, activity:
|
||||||
if (!note.to.includes('https://www.w3.org/ns/activitystreams#Public')) {
|
if (!note.to.includes('https://www.w3.org/ns/activitystreams#Public')) {
|
||||||
if (note.cc.includes('https://www.w3.org/ns/activitystreams#Public')) {
|
if (note.cc.includes('https://www.w3.org/ns/activitystreams#Public')) {
|
||||||
visibility = 'home';
|
visibility = 'home';
|
||||||
|
} else if (note.to.includes(`${actor.uri}/followers`)) { // TODO: person.followerと照合するべき?
|
||||||
|
visibility = 'followers';
|
||||||
} else {
|
} else {
|
||||||
visibility = 'specified';
|
visibility = 'specified';
|
||||||
visibleUsers = await Promise.all(note.to.map(uri => resolvePerson(uri)));
|
visibleUsers = await Promise.all(note.to.map(uri => resolvePerson(uri)));
|
||||||
}
|
}
|
||||||
} if (activity.cc.length == 0) visibility = 'followers';
|
}
|
||||||
//#endergion
|
//#endergion
|
||||||
|
|
||||||
await post(actor, {
|
await post(actor, {
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
export default (id: string, object: any) => ({
|
import config from '../../../config';
|
||||||
|
import { INote } from '../../../models/note';
|
||||||
|
|
||||||
|
export default (object: any, note: INote) => {
|
||||||
|
const attributedTo = `${config.url}/users/${note.userId}`;
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: `${config.url}/notes/${note._id}`,
|
||||||
type: 'Announce',
|
type: 'Announce',
|
||||||
id,
|
published: note.createdAt.toISOString(),
|
||||||
|
to: ['https://www.w3.org/ns/activitystreams#Public'],
|
||||||
|
cc: [attributedTo, `${attributedTo}/followers`],
|
||||||
object
|
object
|
||||||
});
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -235,7 +235,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
|
||||||
|
|
||||||
async function renderActivity(data: Option, note: INote) {
|
async function renderActivity(data: Option, note: INote) {
|
||||||
const content = data.renote && data.text == null
|
const content = data.renote && data.text == null
|
||||||
? renderAnnounce(note._id.toHexString(), data.renote.uri ? data.renote.uri : await renderNote(data.renote))
|
? renderAnnounce(data.renote.uri ? data.renote.uri : await renderNote(data.renote), note)
|
||||||
: renderCreate(await renderNote(note));
|
: renderCreate(await renderNote(note));
|
||||||
|
|
||||||
return packAp(content);
|
return packAp(content);
|
||||||
|
|
Loading…
Reference in a new issue