diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index aa4f56a1a8..bd4fc88d4d 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -1369,6 +1369,7 @@ data ChatErrorType | CEChatStoreChanged | CEInvalidConnReq | CESimplexNameNotFound {simplexName :: SimplexNameInfo} + | CESimplexNameUnprepared {simplexName :: SimplexNameInfo} | CEUnsupportedConnReq | CEInvalidChatMessage {connection :: Connection, msgMeta :: Maybe MsgMetaJSON, messageData :: Text, message :: String} | CEConnReqMessageProhibited diff --git a/src/Simplex/Chat/Library/Commands.hs b/src/Simplex/Chat/Library/Commands.hs index e8ffa21b35..2bfacf26c1 100644 --- a/src/Simplex/Chat/Library/Commands.hs +++ b/src/Simplex/Chat/Library/Commands.hs @@ -4181,15 +4181,20 @@ processChatCommand vr nm = \case case ct_ of Just ct -> case preparedContact ct of Just PreparedContact {connLinkToConnect} -> pure (connLinkToConnect, CPContactAddress (CAPKnown ct)) - Nothing -> throwChatError CEInvalidConnReq + -- Row exists but carries no reconnect link (e.g. created via XInfo, not via prepare). + -- The name resolves; the device just lacks the connection material to re-establish. + Nothing -> throwChatError $ CESimplexNameUnprepared ni Nothing -> throwChatError $ CESimplexNameNotFound ni NTPublicGroup -> do g_ <- withFastStore $ \db -> getGroupInfoBySimplexName db vr user ni case g_ of + -- Mirror gPlan at line ~4133 in the link-based path: a removed member is not a + -- known-and-reconnectable group; treat as "not found" so the caller can try elsewhere. + Just g | memberRemoved (membership g) -> throwChatError $ CESimplexNameNotFound ni Just g -> case preparedGroup g of Just PreparedGroup {connLinkToConnect = ccLink} -> pure (ACCL SCMContact ccLink, CPGroupLink (GLPKnown g (BoolDef False) Nothing (ListDef []))) - Nothing -> throwChatError CEInvalidConnReq + Nothing -> throwChatError $ CESimplexNameUnprepared ni Nothing -> throwChatError $ CESimplexNameNotFound ni connectWithPlan :: User -> IncognitoEnabled -> ACreatedConnLink -> ConnectionPlan -> CM ChatResponse connectWithPlan user@User {userId} incognito ccLink plan diff --git a/src/Simplex/Chat/View.hs b/src/Simplex/Chat/View.hs index 8251cf1f93..c76e643b00 100644 --- a/src/Simplex/Chat/View.hs +++ b/src/Simplex/Chat/View.hs @@ -2626,6 +2626,7 @@ viewChatError isCmd logLevel testView = \case CEChatStoreChanged -> ["error: chat store changed, please restart chat"] CEInvalidConnReq -> viewInvalidConnReq CESimplexNameNotFound ni -> ["no contact or group with simplex name " <> plain (T.unpack (shortNameInfoStr ni))] + CESimplexNameUnprepared ni -> [plain (T.unpack (shortNameInfoStr ni)) <> " is a known contact/group but has no link to reconnect via"] CEUnsupportedConnReq -> [ "", "Connection link is not supported by the your app version, please ugrade it.", plain updateStr] CEInvalidChatMessage Connection {connId} msgMeta_ msg e -> [ plain $