diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 008680f6a..5e293d828 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -1474,6 +1474,7 @@ processChatCommand = \case LastMessages (Just chatName) count search -> withUser $ \user -> do chatRef <- getChatRef user chatName chatResp <- processChatCommand $ APIGetChat chatRef (CPLast count) search + setActive $ chatActiveTo chatName pure $ CRChatItems user (aChatItems . chat $ chatResp) LastMessages Nothing count search -> withUser $ \user -> do chatItems <- withStore $ \db -> getAllChatItems db user (CPLast count) search diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index cd2916c83..89324e9a3 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -143,6 +143,12 @@ defaultInlineFilesConfig = data ActiveTo = ActiveNone | ActiveC ContactName | ActiveG GroupName deriving (Eq) +chatActiveTo :: ChatName -> ActiveTo +chatActiveTo (ChatName cType name) = case cType of + CTDirect -> ActiveC name + CTGroup -> ActiveG name + _ -> ActiveNone + data ChatDatabase = ChatDatabase {chatStore :: SQLiteStore, agentStore :: SQLiteStore} data ChatController = ChatController