-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web: Use Intl.ListFormat rather than .join(", ") #28453
base: main
Are you sure you want to change the base?
Conversation
Hello @CIC4DA, it seems like you have referenced #26936 in your pull request description, but you have not referenced them in your commit message description(s). Referencing an issue in a commit message automatically closes the corresponding issue when the commit is merged, which makes the issue tracker easier to manage. Please run An example of a correctly-formatted commit:
To learn how to write a great commit message, please refer to our guide. |
web/tests/message_store.test.js
Outdated
@@ -132,7 +132,7 @@ test("process_new_message", () => { | |||
|
|||
assert.equal(message.reply_to, "bob@example.com,cindy@example.com"); | |||
assert.equal(message.to_user_ids, "103,104"); | |||
assert.equal(message.display_reply_to, "Bob, Cindy"); | |||
assert.equal(message.display_reply_to, "Bob and Cindy"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The web/src/message_notifications.js
code path appears to use this field for non-display purposes to construct unique keys; I think that might now be incorrect
The web/src/recent_view_ui.js
code also seems to sort by message.display_reply_to
; does that seem correct to you? Might require some auditing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In web/src/message_notifications.js
, we can convert back the internationalized list to an array and then to a list using .join(", "), and then set the key.
Something like this :
const reconstructed_list = message.display_reply_to
.replace('and', '')
.split(',')
.map(item => item.trim())
.join(", ");
key = reconstructedList;
I'm not sure about web/src/recent_view_ui.js
, as it uses message.display_reply_to
for sorting and message.display_reply_to
are already sorted name, with an extra and
in it. Will it effect the sorting of multiple strings?
What is your view about it?
@CIC4DA thanks for working on this; it looks pretty promising. I think what we'll need to merge this are:
I expect to be able to merge most of the commits after that; the |
11f2c26
to
0898321
Compare
@timabbott, I have done the following:
|
I extracted several commits to #28611 to merge those; posting comments on the rest. |
fd883bc
to
8f6c6be
Compare
85c6475
to
8f6c6be
Compare
@timabbott I have made some required changes, and requires suggestion from you on above reviews, kindly take a look. Thanks. |
a4d486c
to
a80e29c
Compare
web/tests/typeahead_helper.test.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function get_cleaned_pm_recipients
of typehead_helper.ts
, was only used in .on(blur) function. But I didn't removed it as it can be used further in future. And to cover it in test, Added a test for get_cleaned_pm_recipients
in typehead_helper.test.js
eaf25b9
to
fb3ce2f
Compare
2db375c
to
e68cbec
Compare
This commit removes the stale code for .on(blur) which was overwritten by input pill code. It includes the following changes: - Removing the .on(blur) function - Refactored composebox_typehead.test.js tests to comply with the change
e68cbec
to
fc09865
Compare
Heads up @CIC4DA, we just merged some commits that conflict with the changes you made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the |
This PR brings internationalization by replacing the inconsistent .join(", ") with Intl.ListFormat for accurate and localized list formatting, using a common utility function.
Screenshot of Visual Changes:
Edit : Removed Internationalization from left side bar.
{ style: "long", type: "conjunction" }
could be changed according to use.Fixes: #26936 Use Intl.ListFormat rather than .join(", ")
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: