Cancel without popup when deleting a meeting where we are not the organizer

This commit is contained in:
QuentinArguillere 2024-08-18 23:24:42 +02:00
parent fcce09843e
commit 3ef0db8645
2 changed files with 11 additions and 2 deletions

View file

@ -111,7 +111,13 @@ struct MeetingFragment: View {
Button(role: .destructive) {
withAnimation {
meetingsListViewModel.selectedMeetingToDelete = meetingViewModel.displayedMeeting
isShowSendCancelMeetingNotificationPopup.toggle()
if let myself = meetingViewModel.myself, myself.isOrganizer == true {
isShowSendCancelMeetingNotificationPopup.toggle()
} else {
// If we're not organizer, directly delete the conference
meetingViewModel.displayedMeeting = nil
meetingsListViewModel.deleteSelectedMeeting()
}
}
} label: {
HStack {

View file

@ -56,10 +56,13 @@ struct MeetingsListBottomSheet: View {
CoreContext.shared.doOnCoreQueue { core in
if let organizerUri = self.meetingsListViewModel.selectedMeetingToDelete?.confInfo.organizer {
if core.defaultAccount?.contactAddress?.weakEqual(address2: organizerUri) ?? false {
// If we are the organizer, display popup for sending
DispatchQueue.main.async {
// If we are the organizer, display popup for sending
self.isShowSendCancelMeetingNotificationPopup = true
}
} else {
// If we are not the organizer, delete meeting locally without popup
meetingsListViewModel.deleteSelectedMeeting()
}
}
}