Claim bot: let me /unclaim my own issues (#1595)
An explicit /unclaim from the owner releases an owner-assigned issue; the sweep still never touches them.
This commit is contained in:
1 parent
716107f0e4
commit
fdb059cfed
2 files changed
+9
-6
No files matched your search
@@ -223,8 +223,8 @@ async function unclaim(github, context) {
|
|||||||
await react(github, context, '+1'); // nothing to release
|
await react(github, context, '+1'); // nothing to release
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (assignees.includes(context.repo.owner)) {
|
if (assignees.includes(context.repo.owner) && user !== context.repo.owner) {
|
||||||
await react(github, context, 'eyes'); // never touched by the bot
|
await react(github, context, 'eyes'); // only the owner releases their own issues
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const allowed = assignees.includes(user) || (await isMaintainer(github, context, user));
|
const allowed = assignees.includes(user) || (await isMaintainer(github, context, user));
|
||||||
|
|||||||
@@ -170,10 +170,13 @@ test('unclaim by a maintainer releases, by a stranger does not', async () => {
|
|||||||
assert.equal(find(w.calls, 'react')[1].content, 'eyes');
|
assert.equal(find(w.calls, 'react')[1].content, 'eyes');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('unclaim never touches an issue assigned to the owner', async () => {
|
test('unclaim on an owner-assigned issue works only for the owner', async () => {
|
||||||
const { github, calls } = fake();
|
let w = fake();
|
||||||
await claim.handleComment({ github, context: ctx('/unclaim', { user: 'bherbruck', assignees: ['bherbruck'], labels: ['in progress'] }), now: NOW });
|
await claim.handleComment({ github: w.github, context: ctx('/unclaim', { user: 'carol', assignees: ['bherbruck'], labels: ['in progress'] }), now: NOW });
|
||||||
assert.equal(find(calls, 'removeLabel'), undefined);
|
assert.equal(find(w.calls, 'removeLabel'), undefined);
|
||||||
|
w = fake();
|
||||||
|
await claim.handleComment({ github: w.github, context: ctx('/unclaim', { user: 'bherbruck', assignees: ['bherbruck'], labels: ['in progress'] }), now: NOW });
|
||||||
|
assert.ok(find(w.calls, 'removeLabel'));
|
||||||
});
|
});
|
||||||
|
|
||||||
const issue = (number, assignees = ['bob']) => ({
|
const issue = (number, assignees = ['bob']) => ({
|
||||||
|
|||||||
Reference in new issue
Block a user