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

feat(crypto): Support verification violation composer banner #29067

Merged
merged 5 commits into from
Jan 31, 2025

Conversation

BillCarsonFr
Copy link
Member

@BillCarsonFr BillCarsonFr commented Jan 22, 2025

Draft: depends on matrix-org/matrix-js-sdk#4646

Following an initial early review, I have refactored the component to now use a viewModel 8325c0c
The update model has also been made a lot more simple, but also less optimized; as an example a UserTrustStatusChanged event will trigger a new computation of all the violations in the room. If we see performances problem this could be improoved

image
image

Following initial review,

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)

@BillCarsonFr BillCarsonFr added the T-Feature Request to add a new feature which does not exist right now label Jan 22, 2025
@BillCarsonFr BillCarsonFr force-pushed the valere/verification_violation_banner branch from 02a2640 to 8325c0c Compare January 28, 2025 14:58
@BillCarsonFr BillCarsonFr added T-Task Tasks for the team like planning and removed T-Feature Request to add a new feature which does not exist right now labels Jan 28, 2025
@BillCarsonFr BillCarsonFr force-pushed the valere/verification_violation_banner branch from dc9ece8 to f56a743 Compare January 29, 2025 08:58
@BillCarsonFr BillCarsonFr marked this pull request as ready for review January 29, 2025 09:23
@BillCarsonFr BillCarsonFr requested a review from a team as a code owner January 29, 2025 09:23
@BillCarsonFr BillCarsonFr requested review from dbkr, MidhunSureshR, florianduros and uhoreg and removed request for MidhunSureshR January 29, 2025 09:23

export type ViolationType = "PinViolation" | "VerificationViolation";

export type ViolationPrompt = {
Copy link
Member

Choose a reason for hiding this comment

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

Could all of these exported things have tsdoc please?

Copy link
Member Author

Choose a reason for hiding this comment

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

done 6b76fbc

onButtonClick: (ev: ButtonEvent) => void;
}

async function mapToViolations(cryptoApi: CryptoApi, members: RoomMember[]): Promise<ViolationPrompt[]> {
Copy link
Member

Choose a reason for hiding this comment

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

This could also do with some doc as it's not super obvious what it does.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done 6b76fbc

},
[crypto, room, loadViolations],
);
useTypedEventEmitter(cli, RoomStateEvent.Events, onRoomStateEvent);
Copy link
Member

Choose a reason for hiding this comment

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

For functions that are defined and then just used once on the next line, probably may as well just use an anonymous one inline.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in 6b76fbc

});
}, [loadViolations]);

let onButtonClick: (ev: ButtonEvent) => void = () => {};
Copy link
Member

Choose a reason for hiding this comment

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

It's a bit weird to assign a different callback to the button depending on the state. Generally you would just have one callback which behaves accordingly. Also, you probably want to make it a useCallback and ideally be a bit more specific than onButtonClick (even though in this case there's only one button).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thx, I tried that d1509b9

Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

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

Thanks, this looks fine to me

Copy link
Member

@uhoreg uhoreg left a comment

Choose a reason for hiding this comment

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

Just a few nits, but looks reasonable.

@BillCarsonFr BillCarsonFr force-pushed the valere/verification_violation_banner branch from c263c81 to 673e0d4 Compare January 31, 2025 14:55
@BillCarsonFr BillCarsonFr added this pull request to the merge queue Jan 31, 2025
Merged via the queue into develop with commit d3a6f34 Jan 31, 2025
31 checks passed
@BillCarsonFr BillCarsonFr deleted the valere/verification_violation_banner branch January 31, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Task Tasks for the team like planning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants