mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 18:03:08 +02:00
wip
This commit is contained in:
parent
30bd467b71
commit
0de40f3a76
4 changed files with 16 additions and 27 deletions
|
@ -7,7 +7,7 @@ import notify from '../../publishers/notify';
|
|||
import context from '../../remote/activitypub/renderer/context';
|
||||
import renderFollow from '../../remote/activitypub/renderer/follow';
|
||||
import renderAccept from '../../remote/activitypub/renderer/accept';
|
||||
import { createHttp } from '../../queue';
|
||||
import { deliver } from '../../queue';
|
||||
|
||||
export default async function(follower: IUser, followee: IUser, activity?) {
|
||||
const following = await Following.insert({
|
||||
|
@ -60,23 +60,13 @@ export default async function(follower: IUser, followee: IUser, activity?) {
|
|||
const content = renderFollow(follower, followee);
|
||||
content['@context'] = context;
|
||||
|
||||
createHttp({
|
||||
type: 'deliver',
|
||||
user: follower,
|
||||
content,
|
||||
to: followee.account.inbox
|
||||
}).save();
|
||||
deliver(follower, content, followee.account.inbox).save();
|
||||
}
|
||||
|
||||
if (isRemoteUser(follower) && isLocalUser(followee)) {
|
||||
const content = renderAccept(activity);
|
||||
content['@context'] = context;
|
||||
|
||||
createHttp({
|
||||
type: 'deliver',
|
||||
user: followee,
|
||||
content,
|
||||
to: follower.account.inbox
|
||||
}).save();
|
||||
deliver(followee, content, follower.account.inbox).save();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import event from '../../publishers/stream';
|
|||
import context from '../../remote/activitypub/renderer/context';
|
||||
import renderFollow from '../../remote/activitypub/renderer/follow';
|
||||
import renderUndo from '../../remote/activitypub/renderer/undo';
|
||||
import { createHttp } from '../../queue';
|
||||
import { deliver } from '../../queue';
|
||||
|
||||
export default async function(follower: IUser, followee: IUser, activity?) {
|
||||
const following = await Following.findOne({
|
||||
|
@ -59,11 +59,6 @@ export default async function(follower: IUser, followee: IUser, activity?) {
|
|||
const content = renderUndo(renderFollow(follower, followee));
|
||||
content['@context'] = context;
|
||||
|
||||
createHttp({
|
||||
type: 'deliver',
|
||||
user: follower,
|
||||
content,
|
||||
to: followee.account.inbox
|
||||
}).save();
|
||||
deliver(follower, content, followee.account.inbox).save();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import Post, { pack, IPost } from '../../models/post';
|
|||
import User, { isLocalUser, IUser } from '../../models/user';
|
||||
import stream from '../../publishers/stream';
|
||||
import Following from '../../models/following';
|
||||
import { createHttp } from '../../queue';
|
||||
import { deliver } from '../../queue';
|
||||
import renderNote from '../../remote/activitypub/renderer/note';
|
||||
import renderCreate from '../../remote/activitypub/renderer/create';
|
||||
import context from '../../remote/activitypub/renderer/context';
|
||||
|
@ -132,12 +132,7 @@ export default async (user: IUser, content: {
|
|||
} else {
|
||||
// フォロワーがリモートユーザーかつ投稿者がローカルユーザーなら投稿を配信
|
||||
if (isLocalUser(user)) {
|
||||
createHttp({
|
||||
type: 'deliver',
|
||||
user,
|
||||
content,
|
||||
to: follower.account.inbox
|
||||
}).save();
|
||||
deliver(user, content, follower.account.inbox).save();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -28,6 +28,15 @@ export function createDb(data) {
|
|||
return queue.create('db', data);
|
||||
}
|
||||
|
||||
export function deliver(user, content, to) {
|
||||
return createHttp({
|
||||
type: 'deliver',
|
||||
user,
|
||||
content,
|
||||
to
|
||||
});
|
||||
}
|
||||
|
||||
export default function() {
|
||||
queue.process('db', db);
|
||||
|
||||
|
|
Loading…
Reference in a new issue