Use consistent check when leaving group

This commit is contained in:
Max Radermacher 2026-04-15 17:41:56 -05:00 committed by GitHub
parent d08c0ab160
commit d387884612
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 7 deletions

View File

@ -87,7 +87,8 @@ extension ThreadContextualActionProvider where Self: UIViewController {
if
let groupThread = threadViewModel.threadRecord as? TSGroupThread,
let groupModel = groupThread.groupModel as? TSGroupModelV2,
let localAci = tsAccountManager.localIdentifiersWithMaybeSneakyTransaction?.aci
let localAci = tsAccountManager.localIdentifiersWithMaybeSneakyTransaction?.aci,
groupModel.groupMembership.isLocalUserFullOrInvitedMember
{
actions.append(leaveGroupContextualAction(
threadViewModel: threadViewModel,

View File

@ -172,7 +172,7 @@ public class BlockListUIUtils {
from viewController: UIViewController,
completion: ((ActionSheetAction) -> Void)?,
) {
guard groupThread.groupModel.groupMembership.isLocalUserMemberOfAnyKind else {
guard groupThread.groupModel.groupMembership.isLocalUserFullOrInvitedMember else {
blockGroupStep2(groupThread, from: viewController, completion: completion)
return
}

View File

@ -15,11 +15,9 @@ public extension GroupManager {
replacementAdminAci: Aci? = nil,
success: (() -> Void)?,
) {
guard groupThread.groupModel.groupMembership.isLocalUserMemberOfAnyKind else {
owsFailDebug("unexpectedly trying to leave group for which we're not a member.")
return
}
// Note: Requests to join aren't handled by this method.
// Note: If we *aren't* a member, this method turns into a no-op.
owsAssertDebug(groupThread.groupModel.groupMembership.isLocalUserFullOrInvitedMember, "must be member")
ModalActivityIndicatorViewController.present(
fromViewController: fromViewController,