mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-30 09:53:02 +00:00
parent
4e9ae8e8d5
commit
a01251477e
2 changed files with 3 additions and 6 deletions
|
@ -10,7 +10,7 @@ import createImage from './image';
|
||||||
|
|
||||||
const log = debug('misskey:activitypub');
|
const log = debug('misskey:activitypub');
|
||||||
|
|
||||||
export default async function createNote(resolver: Resolver, actor: IRemoteUser, note): Promise<IPost> {
|
export default async function createNote(resolver: Resolver, actor: IRemoteUser, note, silent = false): Promise<IPost> {
|
||||||
if (
|
if (
|
||||||
('attributedTo' in note && actor.account.uri !== note.attributedTo) ||
|
('attributedTo' in note && actor.account.uri !== note.attributedTo) ||
|
||||||
typeof note.id !== 'string'
|
typeof note.id !== 'string'
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default async (user: IUser, data: {
|
||||||
visibility?: string;
|
visibility?: string;
|
||||||
uri?: string;
|
uri?: string;
|
||||||
app?: IApp;
|
app?: IApp;
|
||||||
}) => new Promise<IPost>(async (res, rej) => {
|
}, silent = false) => new Promise<IPost>(async (res, rej) => {
|
||||||
if (data.createdAt == null) data.createdAt = new Date();
|
if (data.createdAt == null) data.createdAt = new Date();
|
||||||
if (data.visibility == null) data.visibility = 'public';
|
if (data.visibility == null) data.visibility = 'public';
|
||||||
|
|
||||||
|
@ -127,10 +127,7 @@ export default async (user: IUser, data: {
|
||||||
_id: false
|
_id: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// この投稿が3分以内に作成されたものであるならストリームに配信
|
if (!silent) {
|
||||||
const shouldDistribute = new Date().getTime() - post.createdAt.getTime() < 1000 * 60 * 3;
|
|
||||||
|
|
||||||
if (shouldDistribute) {
|
|
||||||
const note = await renderNote(user, post);
|
const note = await renderNote(user, post);
|
||||||
const content = renderCreate(note);
|
const content = renderCreate(note);
|
||||||
content['@context'] = context;
|
content['@context'] = context;
|
||||||
|
|
Loading…
Reference in a new issue