[fractal] fractal-matrix-api: set history visibility for direct chats



commit 2f4e1ecba67afcdf322daafb6508464963fdca52
Author: Christopher Davis <brainblasted disroot org>
Date:   Tue Mar 12 18:23:55 2019 -0400

    fractal-matrix-api: set history visibility for direct chats
    
    We didn't specify the visibility for participants in direct chats. The default behavior when unspecified 
is confusing,
    and leads to messages sent between the sending of an invite
    and the acceptance of it being dropped.
    
    Now we append a state event to our room creation that
    sets the room visibility to "invited", meaning users
    can see messages from when they were invited.
    
    Closes https://gitlab.gnome.org/GNOME/fractal/issues/327

 fractal-matrix-api/src/backend/room.rs | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/fractal-matrix-api/src/backend/room.rs b/fractal-matrix-api/src/backend/room.rs
index 2349509d..8724ddd2 100644
--- a/fractal-matrix-api/src/backend/room.rs
+++ b/fractal-matrix-api/src/backend/room.rs
@@ -574,6 +574,12 @@ pub fn direct_chat(bk: &Backend, user: &Member, internal_id: String) -> Result<(
         "visibility": "private",
         "preset": "private_chat",
         "is_direct": true,
+        "state_event": {
+            "type": "m.room.history_visibility",
+            "content": {
+                "history_visibility": "invited"
+            }
+        }
     });
 
     let userid = bk.data.lock().unwrap().user_id.clone();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]