Improve team and reviewer sorting

This commit is contained in:
Yuri Sizov
2021-09-04 03:15:19 +03:00
parent 5258330056
commit dbb453ad55
2 changed files with 16 additions and 7 deletions

View File

@@ -228,9 +228,12 @@ export default class PullRequestItem extends LitElement {
const other_teams = [].concat(this.teams);
other_teams.sort((a, b) => {
if (a > b) return 1;
if (a < b) return -1;
return 0;
const a_name = a.toLowerCase().replace(/^_/, "");
const b_name = b.toLowerCase().replace(/^_/, "");
if (a_name > b_name) return 1;
if (a_name < b_name) return -1;
return 0;
});
const authorClassList = [ "pr-author-value" ];

View File

@@ -73,15 +73,21 @@ export default class EntryComponent extends LitElement {
if (a.id === -1) return -1;
if (b.id === -1) return -1;
if (a.name > b.name) return 1;
if (a.name < b.name) return -1;
const a_name = a.name.toLowerCase().replace(/^_/, "");
const b_name = b.name.toLowerCase().replace(/^_/, "");
if (a_name > b_name) return 1;
if (a_name < b_name) return -1;
return 0;
});
this._orderedReviewers = Object.values(this._reviewers);
this._orderedReviewers.sort((a, b) => {
if (a.name > b.name) return 1;
if (a.name < b.name) return -1;
const a_name = a.name.toLowerCase();
const b_name = b.name.toLowerCase();
if (a_name > b_name) return 1;
if (a_name < b_name) return -1;
return 0;
});