Skip to content
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

fix: Time format in quoted message according to user preference #28912

Merged
merged 13 commits into from
Jul 5, 2023

Conversation

ayush3160
Copy link
Contributor

@ayush3160 ayush3160 commented Apr 13, 2023

Proposed changes (including videos or screenshots)

This pull request adds the time format in quoted message according to the user preference in settings.

Images for different Format settings ->

Screenshot 2023-04-14 004135
Screenshot 2023-04-14 004355
Screenshot 2023-04-14 004636

Issue(s)

fix #28863

Steps to test or reproduce

  1. Login with an admin.
  2. In Administration -> Settings -> Message, reset "Time Format" to its default value LT.
  3. In My Account -> Preferences -> Localization, set the "Language" to "English".
  4. In My Account -> Preferences -> Messages, reset the "Time Format" to "Default".
  5. Write a message quoting another one.
  6. Look at the timestamp of the quoted message.
  7. In Administration -> Settings -> Message, set "Time Format" to LTS.
  8. Look at the timestamp of the quoted message.
  9. In Administration -> Settings -> Message, reset "Time Format" to its default value LT.
  10. In My Account -> Preferences -> Messages, set the "Time Format" to "24-hour clock".
  11. Look at the timestamp of the quoted message.

@ayush3160 ayush3160 requested a review from a team as a code owner April 13, 2023 19:44
@codecov
Copy link

codecov bot commented Apr 15, 2023

Codecov Report

Merging #28912 (fc448dc) into develop (d45310c) will increase coverage by 1.81%.
The diff coverage is 60.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #28912      +/-   ##
===========================================
+ Coverage    43.94%   45.76%   +1.81%     
===========================================
  Files          642      681      +39     
  Lines        11766    12879    +1113     
  Branches      2103     2226     +123     
===========================================
+ Hits          5171     5894     +723     
- Misses        6299     6668     +369     
- Partials       296      317      +21     
Flag Coverage Δ
e2e 45.73% <60.00%> (+1.79%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ayush3160
Copy link
Contributor Author

@hugocostadev , Can you please review this PR.

Copy link
Member

@debdutdeb debdutdeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at the code, this will ignore context view of "time range differences" - as in, currently, if the quoted message was sent let's say yesterday, it'll show "yesterday", if within the week but not yesterday, it'll specify the day exactly, and so on.

instead of this, a more appropriate fix would be to incorporate the format hook into the timeago hook.

@hugocostadev
Copy link
Contributor

hugocostadev commented Apr 20, 2023

Hi @ayush3160 ... @debdutdeb it's correct, just a tip:

edit the useTimeAgo() hook and assign the format

const format = useSetting('Message_TimeFormat') as string;

to sameDay key

Check a quoted message from before the same day example:
image

BTW, this is will also fix several other places, check below:
image

@hugocostadev hugocostadev added this to the 6.3.0 milestone Apr 24, 2023
@hugocostadev hugocostadev requested a review from debdutdeb April 26, 2023 11:52
hugocostadev
hugocostadev previously approved these changes Apr 26, 2023
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: needs QA labels Apr 26, 2023
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Apr 27, 2023
@hugocostadev
Copy link
Contributor

@ayush3160 can you resolve the conflict?

@hugocostadev
Copy link
Contributor

I'll review again this PR, some changes were made

@changeset-bot
Copy link

changeset-bot bot commented Jul 3, 2023

🦋 Changeset detected

Latest commit: fc448dc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/api-client Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/models Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Jul 5, 2023
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels Jul 5, 2023
@ggazzo ggazzo merged commit 6fe38a4 into RocketChat:develop Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
communityPR stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quotes do not honor time format settings
6 participants