Sortable.highest_label_priority is bugged

While researching #23079 (closed) I found a couple of bugs in Sortable.highest_label_priority, namely:

  • As used in Todos.order_by_labels_priority, if an Issue and a MergeRequest share the same id their labels will be mixed up.
  • As used in Issuable.order_labels_priority, excluded labels are not actually excluded.