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-05 11:27:36 +00:00
parent 76a577afb3
commit b137ff459e
9 changed files with 50 additions and 10 deletions
@@ -660,7 +660,7 @@ class ChatApi:
raise
async def api_create_active_user(self, profile: T.Profile | None = None) -> T.User:
new_user: T.NewUser = {"pastTimestamp": False, "userChatRelay": False, "clientService": False}
new_user: T.NewUser = {"pastTimestamp": False, "userChatRelay": False, "clientService": False, "keepActiveUser": False}
if profile is not None:
new_user["profile"] = profile
r = await self.send_chat_cmd(CC.CreateActiveUser_cmd_string({"newUser": new_user}))
@@ -2356,6 +2356,7 @@ class NewUser(TypedDict):
pastTimestamp: bool
userChatRelay: bool
clientService: bool
keepActiveUser: bool
class NoteFolder(TypedDict):
noteFolderId: int # int64