mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 22:22:51 +09:00
wip
This commit is contained in:
parent
ec4ed8fb2d
commit
671c5e7c12
@ -5,6 +5,7 @@ import post from '../../../../services/note/create';
|
|||||||
import { IRemoteUser } from '../../../../models/user';
|
import { IRemoteUser } from '../../../../models/user';
|
||||||
import { IAnnounce, INote } from '../../type';
|
import { IAnnounce, INote } from '../../type';
|
||||||
import { fetchNote, resolveNote } from '../../models/note';
|
import { fetchNote, resolveNote } from '../../models/note';
|
||||||
|
import { resolvePerson } from '../../models/person';
|
||||||
|
|
||||||
const log = debug('misskey:activitypub');
|
const log = debug('misskey:activitypub');
|
||||||
|
|
||||||
@ -30,16 +31,22 @@ export default async function(resolver: Resolver, actor: IRemoteUser, activity:
|
|||||||
|
|
||||||
//#region Visibility
|
//#region Visibility
|
||||||
let visibility = 'public';
|
let visibility = 'public';
|
||||||
if (!activity.to.includes('https://www.w3.org/ns/activitystreams#Public')) visibility = 'home';
|
let visibleUsers = [];
|
||||||
if (activity.cc.length == 0) visibility = 'followers';
|
if (!note.to.includes('https://www.w3.org/ns/activitystreams#Public')) {
|
||||||
// TODO
|
if (note.cc.includes('https://www.w3.org/ns/activitystreams#Public')) {
|
||||||
if (visibility != 'public') throw new Error('unspported visibility');
|
visibility = 'home';
|
||||||
|
} else {
|
||||||
|
visibility = 'specified';
|
||||||
|
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, {
|
||||||
createdAt: new Date(activity.published),
|
createdAt: new Date(activity.published),
|
||||||
renote,
|
renote,
|
||||||
visibility,
|
visibility,
|
||||||
|
visibleUsers,
|
||||||
uri
|
uri
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,16 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
|
|||||||
|
|
||||||
//#region Visibility
|
//#region Visibility
|
||||||
let visibility = 'public';
|
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';
|
if (note.cc.length == 0) visibility = 'followers';
|
||||||
// TODO
|
|
||||||
if (visibility != 'public') return null;
|
|
||||||
//#endergion
|
//#endergion
|
||||||
|
|
||||||
// 添付メディア
|
// 添付メディア
|
||||||
@ -99,6 +105,7 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
|
|||||||
viaMobile: false,
|
viaMobile: false,
|
||||||
geo: undefined,
|
geo: undefined,
|
||||||
visibility,
|
visibility,
|
||||||
|
visibleUsers,
|
||||||
uri: note.id
|
uri: note.id
|
||||||
}, silent);
|
}, silent);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user