mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-13 12:16:54 +00:00
refactor: Allow for client identities with no user ID
This commit is contained in:
57 files changed
+212
-185
No files matched your search
@@ -16,6 +16,8 @@ pub(crate) async fn get_threads_route(
|
||||
State(services): State<crate::State>,
|
||||
ref body: Ruma<get_threads::v1::Request>,
|
||||
) -> Result<get_threads::v1::Response> {
|
||||
let sender_user = body.identity.expect_sender_user()?;
|
||||
|
||||
// Use limit or else 10, with maximum 100
|
||||
let limit = body
|
||||
.limit
|
||||
@@ -34,14 +36,14 @@ pub(crate) async fn get_threads_route(
|
||||
let threads: Vec<(PduCount, PduEvent)> = services
|
||||
.rooms
|
||||
.threads
|
||||
.threads_until(body.identity.sender_user(), &body.room_id, from, &body.include)
|
||||
.threads_until(sender_user, &body.room_id, from, &body.include)
|
||||
.await?
|
||||
.take(limit)
|
||||
.filter_map(|(count, pdu)| async move {
|
||||
services
|
||||
.rooms
|
||||
.state_accessor
|
||||
.user_can_see_event(body.identity.sender_user(), &body.room_id, &pdu.event_id)
|
||||
.user_can_see_event(sender_user, &body.room_id, &pdu.event_id)
|
||||
.await
|
||||
.then_some((count, pdu))
|
||||
})
|
||||
@@ -49,7 +51,7 @@ pub(crate) async fn get_threads_route(
|
||||
if let Err(e) = services
|
||||
.rooms
|
||||
.pdu_metadata
|
||||
.add_bundled_aggregations_to_pdu(body.identity.sender_user(), &mut pdu)
|
||||
.add_bundled_aggregations_to_pdu(sender_user, &mut pdu)
|
||||
.await
|
||||
{
|
||||
debug_warn!("Failed to add bundled aggregations to thread: {e}");
|
||||
|
||||
Reference in new issue
Block a user