2019-02-07 20:26:43 +01:00
|
|
|
import $ from 'cafy';
|
|
|
|
import define from '../../../define';
|
|
|
|
import Instance from '../../../../../models/instance';
|
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
params: {
|
|
|
|
host: {
|
|
|
|
validator: $.str
|
|
|
|
},
|
|
|
|
|
|
|
|
isBlocked: {
|
|
|
|
validator: $.bool
|
|
|
|
},
|
2019-02-08 12:56:16 +01:00
|
|
|
|
|
|
|
isClosed: {
|
|
|
|
validator: $.bool
|
|
|
|
},
|
2019-02-07 20:26:43 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-02-22 03:46:58 +01:00
|
|
|
export default define(meta, async (ps, me) => {
|
2019-02-07 20:26:43 +01:00
|
|
|
const instance = await Instance.findOne({ host: ps.host });
|
|
|
|
|
|
|
|
if (instance == null) {
|
2019-02-22 03:46:58 +01:00
|
|
|
throw new Error('instance not found');
|
2019-02-07 20:26:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Instance.update({ host: ps.host }, {
|
|
|
|
$set: {
|
2019-02-08 12:56:16 +01:00
|
|
|
isBlocked: ps.isBlocked,
|
|
|
|
isMarkedAsClosed: ps.isClosed
|
2019-02-07 20:26:43 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-02-22 03:46:58 +01:00
|
|
|
return;
|
|
|
|
});
|