JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Fix repositories for user request not taking in optional authenticated user

Type: Fix

emilia - ⁨2⁩ years ago

parent: tbd commit: ⁨aad12bc

Showing ⁨⁨1⁩ changed file⁩ with ⁨⁨5⁩ insertions⁩ and ⁨⁨2⁩ deletions⁩

src/connection/user.rs

View file
@@ -1,6 +1,7 @@
1 1 use anyhow::Error;
2 2 use serde_json::Value;
3 3
4 use crate::model::authenticated::AuthenticatedUser;
4 5 use crate::{
5 6 messages::user::{
6 7 UserBioRequest, UserDisplayImageRequest, UserDisplayNameRequest, UserRepositoriesRequest,
@@ -78,11 +79,13 @@ async fn bio(
78 79 async fn repositories(
79 80 Message(request): Message<UserRepositoriesRequest>,
80 81 State(connection_state): State<ConnectionState>,
82 requesting_user: Option<AuthenticatedUser>,
81 83 ) -> Result<(), UserError> {
82 let mut repository_backend = connection_state.repository_backend.lock().await;
84 let requesting_user = requesting_user.map(|u| u.0);
83 85
86 let mut repository_backend = connection_state.repository_backend.lock().await;
84 87 let repositories = repository_backend
85 .repositories_for_user(&request.user)
88 .repositories_for_user(requesting_user.as_ref(), &request.user)
86 89 .await;
87 90
88 91 let repositories = match repositories {