add config option for allow_outgoing_read_receipts

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-04-10 15:22:50 -07:00 committed by June
parent 2b54c00f04
commit 6c9e95f7c9
4 changed files with 16 additions and 1 deletions

View file

@ -592,6 +592,10 @@ allow_profile_lookup_federation_requests = true
# Defaults to true.
#allow_incoming_read_receipts = true
# Config option to control whether we should send read receipts to remote servers.
# Defaults to true.
#allow_outgoing_read_receipts = true
# Config option to control outgoing typing updates to federation. Defaults to true.
#allow_outgoing_typing = true

View file

@ -239,6 +239,8 @@ pub struct Config {
#[serde(default = "true_fn")]
pub allow_incoming_read_receipts: bool,
#[serde(default = "true_fn")]
pub allow_outgoing_read_receipts: bool,
#[serde(default = "true_fn")]
pub allow_outgoing_typing: bool,
@ -542,6 +544,10 @@ impl fmt::Display for Config {
"Allow incoming remote read receipts",
&self.allow_incoming_read_receipts.to_string(),
),
(
"Allow outgoing remote read receipts",
&self.allow_outgoing_read_receipts.to_string(),
),
(
"Block non-admin room invites (local and remote, admins can still send and receive invites)",
&self.block_non_admin_invites.to_string(),

View file

@ -299,6 +299,8 @@ impl Service<'_> {
pub fn allow_incoming_read_receipts(&self) -> bool { self.config.allow_incoming_read_receipts }
pub fn allow_outgoing_read_receipts(&self) -> bool { self.config.allow_outgoing_read_receipts }
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 }

View file

@ -450,7 +450,10 @@ impl Service {
.filter_map(Result::ok)
.filter(|user_id| user_id.server_name() == services().globals.server_name()),
);
if !select_edus_receipts(&room_id, since, &mut max_edu_count, &mut events)? {
if services().globals.allow_outgoing_read_receipts()
&& !select_edus_receipts(&room_id, since, &mut max_edu_count, &mut events)?
{
break;
}
}