1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-27 22:38:30 +09:00

Fix job processor interfaces

This commit is contained in:
Akihiko Odaki 2018-04-03 02:09:50 +09:00
parent 45fb451111
commit 63906af5ab
4 changed files with 19 additions and 25 deletions

View File

@ -11,7 +11,7 @@ import context from '../../remote/activitypub/renderer/context';
import render from '../../remote/activitypub/renderer/follow';
import config from '../../config';
export default ({ data }, done) => Following.findOne({ _id: data.following }).then(({ followerId, followeeId }) => {
export default ({ data }) => Following.findOne({ _id: data.following }).then(({ followerId, followeeId }) => {
const promisedFollower = User.findOne({ _id: followerId });
const promisedFollowee = User.findOne({ _id: followeeId });
@ -104,4 +104,4 @@ export default ({ data }, done) => Following.findOne({ _id: data.following }).th
return Promise.all([followerEvent, followeeEvent]);
})
]);
}).then(done, done);
});

View File

@ -1,6 +1,5 @@
import User from '../../models/user';
import act from '../../remote/activitypub/act';
export default ({ data }, done) => User.findOne({ _id: data.actor })
.then(actor => act(actor, data.outbox, false))
.then(() => done(), done);
export default ({ data }) => User.findOne({ _id: data.actor })
.then(actor => act(actor, data.outbox, false));

View File

@ -4,7 +4,7 @@ import User, { IRemoteUser } from '../../models/user';
import act from '../../remote/activitypub/act';
import resolvePerson from '../../remote/activitypub/resolve-person';
export default ({ data }, done) => (async () => {
export default async ({ data }) => {
const keyIdLower = data.signature.keyId.toLowerCase();
let user;
@ -35,4 +35,4 @@ export default ({ data }, done) => (async () => {
}
await act(user, data.inbox, true);
})().then(done, done);
};

View File

@ -1,22 +1,19 @@
import * as request from 'request';
import * as request from 'request-promise-native';
import User from '../../models/user';
const createPost = require('../../server/api/endpoints/posts/create');
export default ({ data }, done) => {
export default async ({ data }) => {
const asyncBot = User.findOne({ _id: data.userId });
// Fetch parent status
request({
const parentStatuses = await request({
url: `${data.parentUrl}/statuses`,
headers: {
'User-Agent': 'misskey'
}
}, async (err, res, body) => {
if (err) {
console.error(err);
return;
}
const parentStatuses = JSON.parse(body);
},
json: true
});
const parentState = parentStatuses[0].state;
const stillFailed = parentState == 'failure' || parentState == 'error';
const text = stillFailed ?
@ -24,6 +21,4 @@ export default ({ data }, done) => {
`**🚨BUILD FAILED🚨**: →→→?[${data.message}](${data.htmlUrl})←←←`;
createPost({ text }, await asyncBot);
done();
});
};