mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-15 21:37:33 +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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user