mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-27 04:53:50 +03:00
feat: Add config option for receiving read receipts
Adds an option for ignoring incoming read receipts over federation
This commit is contained in:
parent
ccc5030896
commit
9d4f2884e1
3 changed files with 43 additions and 35 deletions
|
@ -746,6 +746,7 @@ pub async fn send_transaction_message_route(
|
||||||
match edu {
|
match edu {
|
||||||
Edu::Presence(_) => {}
|
Edu::Presence(_) => {}
|
||||||
Edu::Receipt(receipt) => {
|
Edu::Receipt(receipt) => {
|
||||||
|
if services().globals.allow_receiving_read_receipts() {
|
||||||
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
|
||||||
|
@ -787,6 +788,7 @@ pub async fn send_transaction_message_route(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Edu::Typing(typing) => {
|
Edu::Typing(typing) => {
|
||||||
if services()
|
if services()
|
||||||
.rooms
|
.rooms
|
||||||
|
|
|
@ -49,6 +49,8 @@ pub struct Config {
|
||||||
#[serde(default = "true_fn")]
|
#[serde(default = "true_fn")]
|
||||||
pub allow_public_read_receipts: bool,
|
pub allow_public_read_receipts: bool,
|
||||||
#[serde(default = "true_fn")]
|
#[serde(default = "true_fn")]
|
||||||
|
pub allow_receiving_read_receipts: bool,
|
||||||
|
#[serde(default = "true_fn")]
|
||||||
pub allow_room_creation: bool,
|
pub allow_room_creation: bool,
|
||||||
#[serde(default = "true_fn")]
|
#[serde(default = "true_fn")]
|
||||||
pub allow_unstable_room_versions: bool,
|
pub allow_unstable_room_versions: bool,
|
||||||
|
|
|
@ -238,6 +238,10 @@ impl Service {
|
||||||
self.config.allow_public_read_receipts
|
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 {
|
pub fn allow_room_creation(&self) -> bool {
|
||||||
self.config.allow_room_creation
|
self.config.allow_room_creation
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue