core: allow creating a user without making it active

CreateActiveUser gains keepActiveUser. Creating a user activates it, and
APIChangePreparedContactUser resolves the chat under the active user, so
create-then-reassign cannot find the chat the invitation is for. With the
flag the sequence has nothing to undo: create, reassign while the old
profile still owns it, switch once.

BoolDef makes the field default to False, so older clients and both CLI
parsers are unaffected. It is ignored when there is no active user to
keep, which would otherwise leave none at all.

Includes the regenerated NewUser type in the three generated client
artifacts, and the two hand-synced clients that build a NewUser literal.
This commit is contained in:
Narasimha-sc
2026-09-07 11:52:17 +00:00
parent 5847fa7f31
commit 5c4ebde9cc
9 changed files with 50 additions and 10 deletions
+1 -1
View File
@@ -867,7 +867,7 @@ export class ChatApi {
* Network usage: no.
*/
async apiCreateActiveUser(profile?: T.Profile): Promise<T.User> {
const r = await this.sendChatCmd(CC.CreateActiveUser.cmdString({newUser: {profile, pastTimestamp: false, userChatRelay: false, clientService: false}}))
const r = await this.sendChatCmd(CC.CreateActiveUser.cmdString({newUser: {profile, pastTimestamp: false, userChatRelay: false, clientService: false, keepActiveUser: false}}))
if (r.type === "activeUser") return r.user
throw new ChatCommandError("unexpected response", r)
}