diff --git a/lib/channel/pagination.rs b/lib/channel/pagination.rs index 811bf1c..09022d0 100644 --- a/lib/channel/pagination.rs +++ b/lib/channel/pagination.rs @@ -65,7 +65,7 @@ impl MessagePagination { db::sqlx::query_as::<_, model::room::RoomMessageModel>( db::sqlx::AssertSqlSafe(format!( "SELECT {RM_COLUMNS} FROM room_message \ - WHERE room = $1 AND seq < $2 AND deleted_at IS NULL \ + WHERE room = $1 AND seq < $2 AND deleted_at IS NULL AND thread IS NULL \ ORDER BY seq DESC LIMIT $3" )), ) @@ -79,7 +79,7 @@ impl MessagePagination { db::sqlx::query_as::<_, model::room::RoomMessageModel>( db::sqlx::AssertSqlSafe(format!( "SELECT {RM_COLUMNS} FROM room_message \ - WHERE room = $1 AND seq > $2 AND deleted_at IS NULL \ + WHERE room = $1 AND seq > $2 AND deleted_at IS NULL AND thread IS NULL \ ORDER BY seq ASC LIMIT $3" )), ) @@ -93,7 +93,7 @@ impl MessagePagination { db::sqlx::query_as::<_, model::room::RoomMessageModel>( db::sqlx::AssertSqlSafe(format!( "SELECT {RM_COLUMNS} FROM room_message \ - WHERE room = $1 AND deleted_at IS NULL \ + WHERE room = $1 AND deleted_at IS NULL AND thread IS NULL \ ORDER BY seq DESC LIMIT $2" )), ) diff --git a/lib/channel/reconnect.rs b/lib/channel/reconnect.rs index 97d394c..0b56e4e 100644 --- a/lib/channel/reconnect.rs +++ b/lib/channel/reconnect.rs @@ -22,6 +22,12 @@ pub struct MissedMessage { pub content: String, pub sender_id: Uuid, pub send_at: chrono::DateTime, + pub thread: Option, + pub parent: Option, + pub content_type: String, + pub pinned: bool, + pub system_type: Option, + pub metadata: serde_json::Value, } #[derive(Clone)] @@ -69,7 +75,7 @@ impl ReconnectManager { let messages = db::sqlx::query_as::<_, RoomMessageModel>( db::sqlx::AssertSqlSafe(format!( "SELECT {RM_COLUMNS} FROM room_message \ - WHERE room = $1 AND seq > $2 AND deleted_at IS NULL \ + WHERE room = $1 AND seq > $2 AND deleted_at IS NULL AND thread IS NULL \ ORDER BY seq ASC \ LIMIT 100" )), @@ -88,6 +94,12 @@ impl ReconnectManager { content: m.content, sender_id: m.author, send_at: m.created_at, + thread: m.thread, + parent: m.parent, + content_type: m.content_type, + pinned: m.pinned, + system_type: m.system_type, + metadata: m.metadata, }) .collect();