Skip to content

Listen to events so that encryption icon updates when status changes#28407

Merged
uhoreg merged 3 commits into
element-hq:developfrom
uhoreg:update_encryption_status_icon
Nov 18, 2024
Merged

Listen to events so that encryption icon updates when status changes#28407
uhoreg merged 3 commits into
element-hq:developfrom
uhoreg:update_encryption_status_icon

Conversation

@uhoreg
Copy link
Copy Markdown
Member

@uhoreg uhoreg commented Nov 8, 2024

Fixes #28164

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

@uhoreg uhoreg added the T-Defect label Nov 8, 2024
@uhoreg uhoreg marked this pull request as ready for review November 8, 2024 02:20
@uhoreg uhoreg requested a review from a team as a code owner November 8, 2024 02:20
@uhoreg uhoreg requested review from a team, BillCarsonFr, MidhunSureshR and robintown and removed request for a team November 8, 2024 02:20
Copy link
Copy Markdown
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

LGTM otherwise

Comment thread src/hooks/useEncryptionStatus.ts Outdated
throttle(
() => {
if (client.getCrypto()) {
console.log("getting status");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is not a helpful console message

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ugh. I thought I removed all my debugging messages, but I forgot that one.

Copy link
Copy Markdown
Member

@BillCarsonFr BillCarsonFr left a comment

Choose a reason for hiding this comment

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

Can't say much about react stuffs :/
There are no test for membership changes?

[client, room],
);

useEffect(updateEncryptionStatus, [updateEncryptionStatus]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not familiar with that, the second arg are dependencies? So is this not a cyclic dependencies?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the dependencies specify when useEffect should be called. So this says call updateEncryptionState whenever the method changes, and the method is a useMemo with its own dependencies, so it changes when [client, room] (either) changes.

@uhoreg
Copy link
Copy Markdown
Member Author

uhoreg commented Nov 8, 2024

There are no test for membership changes?

There is a test for membership changes at https://github.com/element-hq/element-web/pull/28407/files#diff-5463cabfb673ce908cb151cfb23ca1085a6a510c7d9f897c76379408ace43fe3R652-R671

Copy link
Copy Markdown
Member

@BillCarsonFr BillCarsonFr left a comment

Choose a reason for hiding this comment

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

LGTM

@uhoreg uhoreg added this pull request to the merge queue Nov 18, 2024
Merged via the queue into element-hq:develop with commit ed97951 Nov 18, 2024
@uhoreg uhoreg deleted the update_encryption_status_icon branch November 18, 2024 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verification | Unexpected verified badge in DM title bar on the other user avatar

3 participants