mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-11-30 16:51:56 +01:00
Fix job processor interfaces
This commit is contained in:
parent
45fb451111
commit
63906af5ab
4 changed files with 19 additions and 25 deletions
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -1,29 +1,24 @@
|
|||
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);
|
||||
const parentState = parentStatuses[0].state;
|
||||
const stillFailed = parentState == 'failure' || parentState == 'error';
|
||||
const text = stillFailed ?
|
||||
`**⚠️BUILD STILL FAILED⚠️**: ?[${data.message}](${data.htmlUrl})` :
|
||||
`**🚨BUILD FAILED🚨**: →→→?[${data.message}](${data.htmlUrl})←←←`;
|
||||
|
||||
createPost({ text }, await asyncBot);
|
||||
done();
|
||||
},
|
||||
json: true
|
||||
});
|
||||
|
||||
const parentState = parentStatuses[0].state;
|
||||
const stillFailed = parentState == 'failure' || parentState == 'error';
|
||||
const text = stillFailed ?
|
||||
`**⚠️BUILD STILL FAILED⚠️**: ?[${data.message}](${data.htmlUrl})` :
|
||||
`**🚨BUILD FAILED🚨**: →→→?[${data.message}](${data.htmlUrl})←←←`;
|
||||
|
||||
createPost({ text }, await asyncBot);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue