desktop: fix profile image lost when creating the first chat profile

createProfileInNoProfileSetup passed the image positionally as Profile's 4th
argument, which is description, not image - so the chosen avatar was stored as
the profile description and no picture was set.

Both are String?, so it type-checked silently. The sibling createProfileInProfiles
avoids this by passing image by name.

Only reachable on desktop with no local chat profile: the user picker then offers
"Create chat profile" (desktopNoUserNoRemote), which opens the profile form with
its avatar picker, and localUserCreated is false so submission takes this branch.
Onboarding is unaffected - both first-profile screens take a name only, with no
avatar picker, and call createProfileOnboarding instead.

Unrelated to the rest of this branch - safe to drop or move to its own PR.
This commit is contained in:
Narasimha-sc
2026-08-03 16:12:10 +00:00
parent 49344c32fb
commit eab9e36300
@@ -404,7 +404,7 @@ fun createProfileFromForm(chatModel: ChatModel, displayName: String, shortDescr:
fun createProfileInNoProfileSetup(displayName: String, image: String? = null, close: () -> Unit) {
withBGApi {
val user = controller.apiCreateActiveUser(null, Profile(displayName.trim(), "", null, image)) ?: return@withBGApi
val user = controller.apiCreateActiveUser(null, Profile(displayName.trim(), "", null, image = image)) ?: return@withBGApi
if (!chatModel.connectedToRemote()) {
chatModel.localUserCreated.value = true
}