Skip to content

Commit

Permalink
Merge branch 'main' into DOP-4306
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry authored Feb 12, 2024
2 parents 353e78c + 88fc4de commit e7ef279
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/services/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,23 @@ export class SlackConnector implements ISlackConnector {
};
reposToShow.push(opt);
});
// THis is the limitation enforced by slack as no more 100 items are allowd in the dropdown

// This is the limitation enforced by slack as no more 100 items are allowd in the dropdown
//Sort the list so that any inactive versions are at the end and will be truncated if any items must be truncated
//'[ERROR] no more than 100 items allowed [json-pointer:/view/blocks/0/element/options]'

if (reposToShow.length > 100) {
reposToShow = reposToShow.splice(0, 100);
reposToShow = reposToShow.sort().reverse().splice(0, 100);
}
reposToShow.sort();

//sort versions like so: 4.1, 4.2, 4.11
reposToShow.sort((a, b) => {
return b.text.text
.toString()
.replace(/\d+/g, (n) => +n + 100000)
.localeCompare(a.text.text.toString().replace(/\d+/g, (n) => +n + 100000));
});

return this._getDropDownView(triggerId, reposToShow);
}
}

0 comments on commit e7ef279

Please sign in to comment.