Commit 7c1e85df authored by Phil Hughes's avatar Phil Hughes

Fix reviewer commands showing all members

Changes the unassign and assign reviewer commands to match
the same logic as assignees.
parent be50224b
...@@ -238,10 +238,13 @@ class GfmAutoComplete { ...@@ -238,10 +238,13 @@ class GfmAutoComplete {
const MEMBER_COMMAND = { const MEMBER_COMMAND = {
ASSIGN: '/assign', ASSIGN: '/assign',
UNASSIGN: '/unassign', UNASSIGN: '/unassign',
ASSIGN_REVIEWER: '/assign_reviewer',
UNASSIGN_REVIEWER: '/unassign_reviewer',
REASSIGN: '/reassign', REASSIGN: '/reassign',
CC: '/cc', CC: '/cc',
}; };
let assignees = []; let assignees = [];
let reviewers = [];
let command = ''; let command = '';
// Team Members // Team Members
...@@ -286,9 +289,11 @@ class GfmAutoComplete { ...@@ -286,9 +289,11 @@ class GfmAutoComplete {
return null; return null;
}); });
// Cache assignees list for easier filtering later // Cache assignees & reviewers list for easier filtering later
assignees = assignees =
SidebarMediator.singleton?.store?.assignees?.map(createMemberSearchString) || []; SidebarMediator.singleton?.store?.assignees?.map(createMemberSearchString) || [];
reviewers =
SidebarMediator.singleton?.store?.reviewers?.map(createMemberSearchString) || [];
const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers); const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers);
return match && match.length ? match[1] : null; return match && match.length ? match[1] : null;
...@@ -309,6 +314,12 @@ class GfmAutoComplete { ...@@ -309,6 +314,12 @@ class GfmAutoComplete {
} else if (command === MEMBER_COMMAND.UNASSIGN) { } else if (command === MEMBER_COMMAND.UNASSIGN) {
// Only include members which are assigned to Issuable currently // Only include members which are assigned to Issuable currently
return data.filter((member) => assignees.includes(member.search)); return data.filter((member) => assignees.includes(member.search));
} else if (command === MEMBER_COMMAND.ASSIGN_REVIEWER) {
// Only include members which are not assigned as a reviewer to Issuable currently
return data.filter((member) => !reviewers.includes(member.search));
} else if (command === MEMBER_COMMAND.UNASSIGN_REVIEWER) {
// Only include members which are not assigned as a reviewer to Issuable currently
return data.filter((member) => reviewers.includes(member.search));
} }
return data; return data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment