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: sidebar last message E2EE #32431

Merged
merged 10 commits into from
Jun 17, 2024
Merged

fix: sidebar last message E2EE #32431

merged 10 commits into from
Jun 17, 2024

Conversation

hugocostadev
Copy link
Contributor

Proposed changes (including videos or screenshots)

If End-to-End Encryption is enabled and you delete the last message in a room the is updated to the last message without a type (t) attribute set which will be last message before the encryption was enabled for this room or no message if no unencrypted message is available.

If you send an encrypted message the lastMessage is updated correctly but on deletion the method Rooms.resetLastMessageById is called which will get the last message by calling Messages.getLastVisibleMessageSentWithNoTypeByRoomId. But an e2e message has the t set to "e2e" and will be ignored.

I did:

  • renamed Messages.getLastVisibleMessageSentWithNoTypeByRoomId function to Messages.getLastVisibleUserMessageSentByRoomId
  • add a query to include e2e type of messages
  • added a end-to-end test

Issue(s)

Steps to test or reproduce

  1. Enable End-to-End Encryption in Settings
  2. Start a new room (no matter which type)
  3. Enable encryption for this room
  4. Write multiple messages with different content
  5. Last message will be shown on the left side (Expanded view)
  6. Delete the last message
  7. Reload the page if the message on the left side is not updating
  8. Find the wrong last message in the preview on the left.

Expected behavior:

The last message is shown nevermind if its an encrypted or unencrypted message

Further comments

https://rocketchat.atlassian.net/browse/E2EE2-12

@hugocostadev hugocostadev requested review from a team as code owners May 14, 2024 13:21
Copy link
Contributor

dionisio-bot bot commented May 14, 2024

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented May 14, 2024

🦋 Changeset detected

Latest commit: c595592

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

This PR includes changesets to release 32 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/model-typings Patch
@rocket.chat/apps Patch
@rocket.chat/models 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
rocketchat-services Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/instance-status Patch
@rocket.chat/presence Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/api-client Patch
@rocket.chat/license Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/ddp-client Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/web-ui-registration 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

Copy link

codecov bot commented May 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.54%. Comparing base (d3ab416) to head (c595592).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #32431      +/-   ##
===========================================
+ Coverage    56.46%   56.54%   +0.08%     
===========================================
  Files         2455     2455              
  Lines        54100    54098       -2     
  Branches     11149    11148       -1     
===========================================
+ Hits         30546    30590      +44     
+ Misses       20899    20847      -52     
- Partials      2655     2661       +6     
Flag Coverage Δ
e2e 56.33% <ø> (+0.13%) ⬆️
unit 72.01% <ø> (+0.03%) ⬆️

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

@hugocostadev hugocostadev added this to the 7.0 milestone May 14, 2024
yash-rajpal
yash-rajpal previously approved these changes May 16, 2024
Copy link
Member

@yash-rajpal yash-rajpal left a comment

Choose a reason for hiding this comment

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

LGTM!

@milton-rucks milton-rucks modified the milestones: 7.0, 6.10 Jun 11, 2024
@milton-rucks milton-rucks added stat: QA assured Means it has been tested and approved by a company insider and removed stat: QA assured Means it has been tested and approved by a company insider labels Jun 11, 2024
@hugocostadev hugocostadev added the stat: ready to merge PR tested and approved waiting for merge label Jun 17, 2024
@kodiakhq kodiakhq bot merged commit eaf2f11 into develop Jun 17, 2024
42 of 45 checks passed
@kodiakhq kodiakhq bot deleted the fix/sidebar_lastMessage_E2EE branch June 17, 2024 12:52
gabriellsh added a commit that referenced this pull request Jun 18, 2024
…retention

* 'develop' of github.com:RocketChat/Rocket.Chat:
  fix: Not possible to edit room without proper permission with retention policy enabled (#32547)
  feat: Apps-Engine Deno Runtime update (#31821)
  feat: E2EE room setup header (#32446)
  fix: E2EE thread main message reactivity (#32381)
  chore: Add telemetry to CI so we can get a better understanding of resource usage (#32113)
  fix: Long katex strings breaking overflow in x axis (#32609)
  fix: Force highlighted code language registration (#32507)
  fix: sidebar last message E2EE (#32431)
  chore: remove message column on moderation console (#32432)
  fix: Accepted Media Types settings validation (#32478)
This was referenced Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants