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