Skip to content

Commit 95de687

Browse files
SeniorZhaicrossle
andauthored
fix(job): guard group conversation in MixinJob.createConversation (#6416)
* fix(job): skip auto-create for group conversation in checkConversationExist The createConversation path in MixinJob builds a minimal ConversationRequest without random_id, name, announcement, or full participants. When a GROUP conversation falls into SendMessageJob's checkConversationExist with a non-SUCCESS status, it triggers /conversations create with category=GROUP but no random_id, which the server rejects (missing or invalid UUID). Short-circuit groups here so creation stays on the proper flow via GroupViewModel / ConversationListViewModel.createGroupConversation, which always supplies a valid randomId. * fix(job): guard against group conversation in createConversation createConversation builds a minimal ConversationRequest without random_id, name, or full participants, which is only valid for CONTACT (1v1) where the conversationId is deterministically derived from two userIds. If a GROUP slips into this path (e.g. SendMessageJob.checkConversationExist on a non-SUCCESS local group), the /conversations POST hits the server with category=GROUP but no random_id, yielding 'invalid UUID' or missing-param errors and a broken group on the server. Bail out early for groups and report the unexpected state so the proper GroupViewModel / ConversationListViewModel flow remains the only path that creates groups. --------- Co-authored-by: Crossle Song <crosslesong@gmail.com>
1 parent 53c76fa commit 95de687

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

app/src/main/java/one/mixin/android/job/MixinJob.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ abstract class MixinJob(
182182
}
183183

184184
private fun createConversation(conversation: Conversation): Long? {
185+
if (conversation.isGroupConversation()) {
186+
reportException(
187+
"Skip MixinJob.createConversation for group",
188+
IllegalStateException("conversation_id=${conversation.conversationId}"),
189+
)
190+
return conversation.expireIn
191+
}
185192
val request =
186193
ConversationRequest(
187194
conversationId = conversation.conversationId,

0 commit comments

Comments
 (0)