config option to allow incoming remote read receipts

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-17 12:16:04 -04:00 committed by June
parent b78d79a45a
commit a7966b8f05
4 changed files with 17 additions and 1 deletions

View file

@ -357,7 +357,7 @@ url_preview_check_root_domain = false
### Presence ### Presence / Typing Indicators / Read Receipts
# Config option to control local (your server only) presence updates/requests. Defaults to false. # Config option to control local (your server only) presence updates/requests. Defaults to false.
# Note that presence on conduwuit is very fast unlike Synapse's. # Note that presence on conduwuit is very fast unlike Synapse's.
@ -385,6 +385,9 @@ url_preview_check_root_domain = false
# Config option to control how many seconds before presence updates that you are offline. Defaults to 30 minutes. # Config option to control how many seconds before presence updates that you are offline. Defaults to 30 minutes.
#presence_offline_timeout_s = 1800 #presence_offline_timeout_s = 1800
# Config option to control whether we should receive remote incoming read receipts.
# Defaults to true.
#allow_incoming_read_receipts = true
# Other options not in [global]: # Other options not in [global]:

View file

@ -823,6 +823,10 @@ pub async fn send_transaction_message_route(
} }
}, },
Edu::Receipt(receipt) => { Edu::Receipt(receipt) => {
if !services().globals.allow_incoming_read_receipts() {
continue;
}
for (room_id, room_updates) in receipt.receipts { for (room_id, room_updates) in receipt.receipts {
for (user_id, user_updates) in room_updates.read { for (user_id, user_updates) in room_updates.read {
if let Some((event_id, _)) = user_updates if let Some((event_id, _)) = user_updates

View file

@ -144,6 +144,9 @@ pub struct Config {
#[serde(default = "default_presence_offline_timeout_s")] #[serde(default = "default_presence_offline_timeout_s")]
pub presence_offline_timeout_s: u64, pub presence_offline_timeout_s: u64,
#[serde(default = "true_fn")]
pub allow_incoming_read_receipts: bool,
#[serde(default)] #[serde(default)]
pub zstd_compression: bool, pub zstd_compression: bool,
@ -282,6 +285,10 @@ impl fmt::Display for Config {
"Allow local presence requests (updates)", "Allow local presence requests (updates)",
&self.allow_local_presence.to_string(), &self.allow_local_presence.to_string(),
), ),
(
"Allow incoming remote read receipts",
&self.allow_incoming_read_receipts.to_string(),
),
( (
"Block non-admin room invites (local and remote, admins can still send and receive invites)", "Block non-admin room invites (local and remote, admins can still send and receive invites)",
&self.block_non_admin_invites.to_string(), &self.block_non_admin_invites.to_string(),

View file

@ -359,6 +359,8 @@ impl Service<'_> {
pub fn presence_offline_timeout_s(&self) -> u64 { self.config.presence_offline_timeout_s } pub fn presence_offline_timeout_s(&self) -> u64 { self.config.presence_offline_timeout_s }
pub fn allow_incoming_read_receipts(&self) -> bool { self.config.allow_incoming_read_receipts }
pub fn rocksdb_log_level(&self) -> &String { &self.config.rocksdb_log_level } pub fn rocksdb_log_level(&self) -> &String { &self.config.rocksdb_log_level }
pub fn rocksdb_max_log_file_size(&self) -> usize { self.config.rocksdb_max_log_file_size } pub fn rocksdb_max_log_file_size(&self) -> usize { self.config.rocksdb_max_log_file_size }