diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2024-10-12 19:23:47 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2024-10-21 20:12:28 +0200 |
commit | 7fb2f923f3cec61964f223cef7b60c8e8bb7fc3b (patch) | |
tree | 514e1b00935facd8b505010ed6d4f6de0fdb4065 | |
parent | c506520d28bfa9adb6c9cd2f8e719c1a35a84bbe (diff) |
Chatroom: unsubscribe when leaving
-rw-r--r-- | src/Erebos/Chatroom.hs | 2 | ||||
-rw-r--r-- | test/chatroom.test | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/Erebos/Chatroom.hs b/src/Erebos/Chatroom.hs index c8b5805..5ba137f 100644 --- a/src/Erebos/Chatroom.hs +++ b/src/Erebos/Chatroom.hs @@ -205,7 +205,7 @@ sendRawChatroomMessageByStateData lookupData mdReplyTo mdText mdLeave = void $ f mergeSorted . (:[]) <$> mstore ChatroomStateData { rsdPrev = roomStateData cstate , rsdRoom = [] - , rsdSubscribe = Just True + , rsdSubscribe = Just (not mdLeave) , rsdMessages = [ mdata ] } diff --git a/test/chatroom.test b/test/chatroom.test index 93de1ff..deea2cb 100644 --- a/test/chatroom.test +++ b/test/chatroom.test @@ -413,9 +413,12 @@ test ChatroomMembers: send "chatroom-leave $room1_p1" to p1 send "chatroom-leave $room1_p3" to p3 - for p in [ p1, p2, p3 ]: + for p in [ p1, p2 ]: with p: expect /chatroom-message-new [a-z0-9#]+ room first_room from Owner1 leave/ + + for p in [ p2, p3 ]: + with p: expect /chatroom-message-new [a-z0-9#]+ room first_room from Owner3 leave/ send "chatroom-members $room1_p1" to p1 |