Sort feed list alphabetically in bot command response (#791)

* Sort feed list alphabetically in bot command response

Fixes GH-790

* Changelog

* Linting

---------

Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com>
This commit is contained in:
Tadeusz Sośnierz 2023-07-03 14:24:58 +02:00 committed by GitHub
parent 4351a37131
commit 1c54506f6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

1
changelog.d/791.misc Normal file
View File

@ -0,0 +1 @@
Sort feed list alphabetically in bot command response

View File

@ -290,7 +290,9 @@ export class SetupConnection extends CommandConnection {
if (feeds.length === 0) {
return this.client.sendHtmlNotice(this.roomId, md.renderInline('Not subscribed to any feeds'));
} else {
const feedDescriptions = feeds.map(feed => {
const feedDescriptions = feeds.sort(
(a, b) => (a.label ?? a.url).localeCompare(b.label ?? b.url)
).map(feed => {
if (feed.label) {
return `[${feed.label}](${feed.url})`;
}