This commit is contained in:
syuilo
2018-04-29 04:44:58 +09:00
parent ec4ed8fb2d
commit 671c5e7c12
2 changed files with 21 additions and 7 deletions

View File

@@ -65,10 +65,16 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
//#region Visibility
let visibility = 'public';
if (!note.to.includes('https://www.w3.org/ns/activitystreams#Public')) visibility = 'home';
let visibleUsers = [];
if (!note.to.includes('https://www.w3.org/ns/activitystreams#Public')) {
if (note.cc.includes('https://www.w3.org/ns/activitystreams#Public')) {
visibility = 'home';
} else {
visibility = 'specified';
visibleUsers = await Promise.all(note.to.map(uri => resolvePerson(uri)));
}
}
if (note.cc.length == 0) visibility = 'followers';
// TODO
if (visibility != 'public') return null;
//#endergion
// 添付メディア
@@ -99,6 +105,7 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
viaMobile: false,
geo: undefined,
visibility,
visibleUsers,
uri: note.id
}, silent);
}