feat: Add config option for disabling sending public read receipts
Treats requests like private receipts
This commit is contained in:
parent
e8d435c541
commit
ccc5030896
3 changed files with 50 additions and 42 deletions
|
@ -61,6 +61,7 @@ pub async fn set_read_marker_route(
|
|||
"Event does not exist.",
|
||||
))?;
|
||||
|
||||
if services().globals.allow_public_read_receipts() {
|
||||
let mut user_receipts = BTreeMap::new();
|
||||
user_receipts.insert(
|
||||
sender_user.clone(),
|
||||
|
@ -84,7 +85,7 @@ pub async fn set_read_marker_route(
|
|||
room_id: body.room_id.clone(),
|
||||
},
|
||||
)?;
|
||||
|
||||
};
|
||||
services().rooms.edus.read_receipt.private_read_set(
|
||||
&body.room_id,
|
||||
sender_user,
|
||||
|
@ -128,6 +129,7 @@ pub async fn create_receipt_route(
|
|||
"Event does not exist.",
|
||||
))?;
|
||||
|
||||
if services().globals.allow_public_read_receipts() {
|
||||
let mut user_receipts = BTreeMap::new();
|
||||
user_receipts.insert(
|
||||
sender_user.clone(),
|
||||
|
@ -150,7 +152,7 @@ pub async fn create_receipt_route(
|
|||
room_id: body.room_id.clone(),
|
||||
},
|
||||
)?;
|
||||
|
||||
};
|
||||
services().rooms.edus.read_receipt.private_read_set(
|
||||
&body.room_id,
|
||||
sender_user,
|
||||
|
|
|
@ -47,6 +47,8 @@ pub struct Config {
|
|||
#[serde(default = "false_fn")]
|
||||
pub allow_federation: bool,
|
||||
#[serde(default = "true_fn")]
|
||||
pub allow_public_read_receipts: bool,
|
||||
#[serde(default = "true_fn")]
|
||||
pub allow_room_creation: bool,
|
||||
#[serde(default = "true_fn")]
|
||||
pub allow_unstable_room_versions: bool,
|
||||
|
|
|
@ -234,6 +234,10 @@ impl Service {
|
|||
self.config.allow_federation
|
||||
}
|
||||
|
||||
pub fn allow_public_read_receipts(&self) -> bool {
|
||||
self.config.allow_public_read_receipts
|
||||
}
|
||||
|
||||
pub fn allow_room_creation(&self) -> bool {
|
||||
self.config.allow_room_creation
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue