mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Prompt user when inviting users with uncached identities (#5331)
If the user attempts to invite someone (to a room or creating a DM) whose identity is not cached, we prompt them to make sure this was their intention.
This commit is contained in:
@@ -67,8 +67,21 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
hideLoadingIndicator()
|
||||
actionsSubject.send(.showRoom(roomID: roomId))
|
||||
case .success:
|
||||
hideLoadingIndicator()
|
||||
state.bindings.selectedUserToInvite = user
|
||||
if appSettings.enableKeyShareOnInvite {
|
||||
Task {
|
||||
// If an error occured while fetching the identity, assume they are unknown.
|
||||
let isUnknown = if case .success(let identity) = await self.userSession.clientProxy.userIdentity(for: user.userID, fallBackToServer: false) {
|
||||
identity == nil
|
||||
} else {
|
||||
true
|
||||
}
|
||||
self.state.bindings.selectedUserToInvite = UserToInvite(user: user, isUnknown: isUnknown)
|
||||
hideLoadingIndicator()
|
||||
}
|
||||
} else {
|
||||
hideLoadingIndicator()
|
||||
state.bindings.selectedUserToInvite = UserToInvite(user: user, isUnknown: false)
|
||||
}
|
||||
case .failure:
|
||||
hideLoadingIndicator()
|
||||
displayError()
|
||||
|
||||
Reference in New Issue
Block a user