1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-06-27 16:35:59 +00:00

feat: Add config option for receiving read receipts

Adds an option for ignoring incoming read receipts over federation
This commit is contained in:
Nyaaori 2022-11-26 15:01:12 +01:00
parent 96c2cb9469
commit c366e0a5ce
No known key found for this signature in database
GPG key ID: E7819C3ED4D1F82E
3 changed files with 43 additions and 35 deletions

View file

@ -748,6 +748,7 @@ pub async fn send_transaction_message_route(
match edu {
Edu::Presence(_) => {}
Edu::Receipt(receipt) => {
if services().globals.allow_receiving_read_receipts() {
for (room_id, room_updates) in receipt.receipts {
for (user_id, user_updates) in room_updates.read {
if let Some((event_id, _)) = user_updates
@ -789,6 +790,7 @@ pub async fn send_transaction_message_route(
}
}
}
}
Edu::Typing(typing) => {
if services()
.rooms

View file

@ -49,6 +49,8 @@ pub struct Config {
#[serde(default = "true_fn")]
pub allow_public_read_receipts: bool,
#[serde(default = "true_fn")]
pub allow_receiving_read_receipts: bool,
#[serde(default = "true_fn")]
pub allow_room_creation: bool,
#[serde(default = "true_fn")]
pub allow_unstable_room_versions: bool,

View file

@ -238,6 +238,10 @@ impl Service {
self.config.allow_public_read_receipts
}
pub fn allow_receiving_read_receipts(&self) -> bool {
self.config.allow_receiving_read_receipts
}
pub fn allow_room_creation(&self) -> bool {
self.config.allow_room_creation
}