Fix job processor interfaces
This commit is contained in:
parent
45fb451111
commit
63906af5ab
|
@ -11,7 +11,7 @@ import context from '../../remote/activitypub/renderer/context';
|
||||||
import render from '../../remote/activitypub/renderer/follow';
|
import render from '../../remote/activitypub/renderer/follow';
|
||||||
import config from '../../config';
|
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 promisedFollower = User.findOne({ _id: followerId });
|
||||||
const promisedFollowee = User.findOne({ _id: followeeId });
|
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]);
|
return Promise.all([followerEvent, followeeEvent]);
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}).then(done, done);
|
});
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import User from '../../models/user';
|
import User from '../../models/user';
|
||||||
import act from '../../remote/activitypub/act';
|
import act from '../../remote/activitypub/act';
|
||||||
|
|
||||||
export default ({ data }, done) => User.findOne({ _id: data.actor })
|
export default ({ data }) => User.findOne({ _id: data.actor })
|
||||||
.then(actor => act(actor, data.outbox, false))
|
.then(actor => act(actor, data.outbox, false));
|
||||||
.then(() => done(), done);
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import User, { IRemoteUser } from '../../models/user';
|
||||||
import act from '../../remote/activitypub/act';
|
import act from '../../remote/activitypub/act';
|
||||||
import resolvePerson from '../../remote/activitypub/resolve-person';
|
import resolvePerson from '../../remote/activitypub/resolve-person';
|
||||||
|
|
||||||
export default ({ data }, done) => (async () => {
|
export default async ({ data }) => {
|
||||||
const keyIdLower = data.signature.keyId.toLowerCase();
|
const keyIdLower = data.signature.keyId.toLowerCase();
|
||||||
let user;
|
let user;
|
||||||
|
|
||||||
|
@ -35,4 +35,4 @@ export default ({ data }, done) => (async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
await act(user, data.inbox, true);
|
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';
|
import User from '../../models/user';
|
||||||
const createPost = require('../../server/api/endpoints/posts/create');
|
const createPost = require('../../server/api/endpoints/posts/create');
|
||||||
|
|
||||||
export default ({ data }, done) => {
|
export default async ({ data }) => {
|
||||||
const asyncBot = User.findOne({ _id: data.userId });
|
const asyncBot = User.findOne({ _id: data.userId });
|
||||||
|
|
||||||
// Fetch parent status
|
// Fetch parent status
|
||||||
request({
|
const parentStatuses = await request({
|
||||||
url: `${data.parentUrl}/statuses`,
|
url: `${data.parentUrl}/statuses`,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': 'misskey'
|
'User-Agent': 'misskey'
|
||||||
}
|
},
|
||||||
}, async (err, res, body) => {
|
json: true
|
||||||
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();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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 New Issue