-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
02a2640
to
8325c0c
Compare
dc9ece8
to
f56a743
Compare
|
||
export type ViolationType = "PinViolation" | "VerificationViolation"; | ||
|
||
export type ViolationPrompt = { |
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.
Could all of these exported things have tsdoc please?
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.
done 6b76fbc
onButtonClick: (ev: ButtonEvent) => void; | ||
} | ||
|
||
async function mapToViolations(cryptoApi: CryptoApi, members: RoomMember[]): Promise<ViolationPrompt[]> { |
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.
This could also do with some doc as it's not super obvious what it does.
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.
Done 6b76fbc
}, | ||
[crypto, room, loadViolations], | ||
); | ||
useTypedEventEmitter(cli, RoomStateEvent.Events, onRoomStateEvent); |
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.
For functions that are defined and then just used once on the next line, probably may as well just use an anonymous one inline.
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.
Done in 6b76fbc
}); | ||
}, [loadViolations]); | ||
|
||
let onButtonClick: (ev: ButtonEvent) => void = () => {}; |
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.
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).
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.
Thx, I tried that d1509b9
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.
Thanks, this looks fine to me
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.
Just a few nits, but looks reasonable.
test/unit-tests/components/views/rooms/UserIdentityWarning-test.tsx
Outdated
Show resolved
Hide resolved
test/unit-tests/components/views/rooms/UserIdentityWarning-test.tsx
Outdated
Show resolved
Hide resolved
test/unit-tests/components/views/rooms/UserIdentityWarning-test.tsx
Outdated
Show resolved
Hide resolved
test/unit-tests/components/views/rooms/UserIdentityWarning-test.tsx
Outdated
Show resolved
Hide resolved
fixup: logger import fixup: test lint type problems fix test having an unexpected verification violation fixup sonarcubes warnings
c263c81
to
673e0d4
Compare
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 improovedFollowing initial review,
Checklist
public
/exported
symbols have accurate TSDoc documentation.