mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-09 18:16:20 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user