Dropdown list of epics that are selectable as "children" epics include ones already linked

Ancestor and children issues (as well as the epic itself) appear in the dropdown list.

To reproduce:

  1. Create an epic in mygroup and call it EpicA (assume it's &1).
  2. Create a different epic in the same group and call it EpicB, &2.
  3. In EpicA's epics list (e.g. http://localhost:3001/groups/mygroup/-/epics/1), click "Add an epic" and add EpicB as a child epic.
  4. Reload EpicA's epics list.
  5. Type in &2 or &EpicB and see EpicB appear on the list, even though it's already linked.
  6. If you go to EpicB's epic list and click "Add an epic" and type &1 or &E you'll also see EpicA, even though it is an ancestor (and listed on the right hand sidebar).

Locally:

image

Somewhat related to #37009 (closed).

Edited by charlie ablett