diff --git a/modules/m_command.cc b/modules/m_command.cc index 034a8bc9c..a54dd122d 100644 --- a/modules/m_command.cc +++ b/modules/m_command.cc @@ -502,7 +502,8 @@ command__read(const mutable_buffer &buf, // Commit the receipt. m::receipt::read(room_id, user, event_id, json::strung{json::members { - { "ts", ms }, + { "ts", ms }, + { "m.hidden", true }, }}); put(room_id, event_id); diff --git a/modules/m_receipt.cc b/modules/m_receipt.cc index c0912850d..be81d0588 100644 --- a/modules/m_receipt.cc +++ b/modules/m_receipt.cc @@ -253,17 +253,13 @@ ircd::m::receipt::read(const m::room::id &room_id, user_id }; - const time_t &ms - { - options.get("ts", ircd::time()) - }; - const auto evid { send(user_room, user_id, "ircd.read", room_id, { - { "event_id", event_id }, - { "ts", ms } + { "event_id", event_id }, + { "ts", options.get("ts", ircd::time()) }, + { "m.hidden", options.get("m.hidden", false) }, }) }; @@ -547,6 +543,11 @@ try at<"content"_>(event).at("event_id") }; + // MSC2285; if m.hidden is set here we don't broadcast this receipt + // to the federation; nothing further to do here then. + if(at<"content"_>(event).get("m.hidden", false)) + return; + // Lastly, we elide broadcasts of receipts for a user's own message. m::user::id::buf sender_buf; if(m::get(std::nothrow, event_id, "sender", sender_buf) == user.user_id)