Fix request to rejoin after group updates bug.

This commit is contained in:
Cody Henthorne
2024-06-24 12:48:19 -04:00
committed by Greyson Parrelli
parent 57a70c3085
commit 21ada2a503
5 changed files with 10 additions and 5 deletions

View File

@@ -60,12 +60,16 @@ final class GroupJoinRepository {
callback.onComplete(new JoinGroupSuccess(groupActionResult.getGroupRecipient(), groupActionResult.getThreadId()));
} catch (IOException e) {
Log.w(TAG, "Network error", e);
callback.onError(JoinGroupError.NETWORK_ERROR);
} catch (GroupChangeBusyException e) {
Log.w(TAG, "Change error", e);
callback.onError(JoinGroupError.BUSY);
} catch (GroupLinkNotActiveException e) {
Log.w(TAG, "Inactive group error", e);
callback.onError(e.getReason() == GroupLinkNotActiveException.Reason.BANNED ? JoinGroupError.BANNED : JoinGroupError.GROUP_LINK_NOT_ACTIVE);
} catch (GroupChangeFailedException | MembershipNotSuitableForV2Exception e) {
Log.w(TAG, "Change failed", e);
callback.onError(JoinGroupError.FAILED);
}
});

View File

@@ -158,7 +158,7 @@ class GroupsV2StateProcessor private constructor(
when (serverUpdateResult) {
InternalUpdateResult.NoUpdateNeeded -> return GroupUpdateResult.CONSISTENT_OR_AHEAD
is InternalUpdateResult.Updated -> return GroupUpdateResult.updated(serverUpdateResult.updatedLocalState)
is InternalUpdateResult.UpdateFailed -> throw serverUpdateResult.throwable
is InternalUpdateResult.UpdateFailed,
is InternalUpdateResult.NotAMember -> Unit
}
@@ -184,7 +184,11 @@ class GroupsV2StateProcessor private constructor(
profileAndMessageHelper.leaveGroupLocally(serviceIds)
}
throw GroupNotAMemberException(serverUpdateResult.exception)
throw when (serverUpdateResult) {
is InternalUpdateResult.NotAMember -> GroupNotAMemberException(serverUpdateResult.exception)
is InternalUpdateResult.UpdateFailed -> throw serverUpdateResult.throwable
else -> AssertionError("Should not reach here with ${serverUpdateResult::class.java.simpleName}")
}
}
private fun canApplyP2pChange(