mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-04 01:41:43 +00:00
core: prevent making all users inactive when duplicate user is created (#1862)
* core: prevent making all users inactive when duplicate user is created * skip async group test
This commit is contained in:
committed by
GitHub
parent
a1ed0a84b8
commit
13bd51b97d
+5
-2
@@ -273,13 +273,16 @@ toView event = do
|
||||
processChatCommand :: forall m. ChatMonad m => ChatCommand -> m ChatResponse
|
||||
processChatCommand = \case
|
||||
ShowActiveUser -> withUser' $ pure . CRActiveUser
|
||||
CreateActiveUser p sameServers -> do
|
||||
CreateActiveUser p@Profile {displayName} sameServers -> do
|
||||
u <- asks currentUser
|
||||
(smp, smpServers) <- chooseServers
|
||||
auId <-
|
||||
withStore' getUsers >>= \case
|
||||
[] -> pure 1
|
||||
_ -> withAgent (`createUser` smp)
|
||||
users -> do
|
||||
when (any (\User {localDisplayName = n} -> n == displayName) users) $
|
||||
throwChatError $ CEUserExists displayName
|
||||
withAgent (`createUser` smp)
|
||||
user <- withStore $ \db -> createUserRecord db (AgentUserId auId) p True
|
||||
unless (null smpServers) $
|
||||
withStore $ \db -> overwriteSMPServers db user smpServers
|
||||
|
||||
Reference in New Issue
Block a user