mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-06-30 05:44:28 +02:00
feat: Only allow private read receipts when suspended
This commit is contained in:
parent
08527a2880
commit
1124097bd1
1 changed files with 27 additions and 22 deletions
|
@ -58,29 +58,34 @@ pub(crate) async fn set_read_marker_route(
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(event) = &body.read_receipt {
|
if let Some(event) = &body.read_receipt {
|
||||||
let receipt_content = BTreeMap::from_iter([(
|
if !services.users.is_suspended(sender_user).await? {
|
||||||
event.to_owned(),
|
let receipt_content = BTreeMap::from_iter([(
|
||||||
BTreeMap::from_iter([(
|
event.to_owned(),
|
||||||
ReceiptType::Read,
|
BTreeMap::from_iter([(
|
||||||
BTreeMap::from_iter([(sender_user.to_owned(), ruma::events::receipt::Receipt {
|
ReceiptType::Read,
|
||||||
ts: Some(MilliSecondsSinceUnixEpoch::now()),
|
BTreeMap::from_iter([(
|
||||||
thread: ReceiptThread::Unthreaded,
|
sender_user.to_owned(),
|
||||||
})]),
|
ruma::events::receipt::Receipt {
|
||||||
)]),
|
ts: Some(MilliSecondsSinceUnixEpoch::now()),
|
||||||
)]);
|
thread: ReceiptThread::Unthreaded,
|
||||||
|
},
|
||||||
|
)]),
|
||||||
|
)]),
|
||||||
|
)]);
|
||||||
|
|
||||||
services
|
services
|
||||||
.rooms
|
.rooms
|
||||||
.read_receipt
|
.read_receipt
|
||||||
.readreceipt_update(
|
.readreceipt_update(
|
||||||
sender_user,
|
sender_user,
|
||||||
&body.room_id,
|
&body.room_id,
|
||||||
&ruma::events::receipt::ReceiptEvent {
|
&ruma::events::receipt::ReceiptEvent {
|
||||||
content: ruma::events::receipt::ReceiptEventContent(receipt_content),
|
content: ruma::events::receipt::ReceiptEventContent(receipt_content),
|
||||||
room_id: body.room_id.clone(),
|
room_id: body.room_id.clone(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(event) = &body.private_read_receipt {
|
if let Some(event) = &body.private_read_receipt {
|
||||||
|
|
Loading…
Add table
Reference in a new issue