···22use atproto_client::client::get_dpop_json_with_headers;
33use http::HeaderMap;
44use reqwest::Client;
55-use serde::Deserialize;
6576use crate::atproto::auth::create_dpop_auth_from_aip_session;
87use crate::config::OAuthBackendConfig;
···109use crate::http::errors::LoginError;
1110use crate::http::errors::web_error::WebError;
1211use crate::http::middleware_auth::Auth;
1313-1414-#[derive(Deserialize)]
1515-struct GetServiceAuthResponse {
1616- #[allow(dead_code)]
1717- token: String,
1818-}
19122013/// Result of checking if an AIP session is ready for AT Protocol operations.
2114pub(crate) enum AipSessionStatus {
+1-8
src/http/errors/profile_import_error.rs
···55/// These errors typically happen when attempting to import a user's Bluesky profile
66/// (`app.bsky.actor.profile`) to create a Smokesignal profile on first login.
77#[derive(Debug, Error)]
88+#[allow(clippy::enum_variant_names)]
89pub(crate) enum ProfileImportError {
99- /// User already has a Smokesignal profile, import skipped.
1010- #[error("error-smokesignal-profile-import-1 User already has profile")]
1111- ProfileAlreadyExists,
1212-1310 /// Failed to fetch the Bluesky profile from the user's PDS.
1411 #[error("error-smokesignal-profile-import-2 Failed to fetch Bluesky profile: {0}")]
1512 FetchFailed(String),
···3734 /// Failed to store the profile locally in the database.
3835 #[error("error-smokesignal-profile-import-8 Failed to store profile locally: {0}")]
3936 StorageFailed(String),
4040-4141- /// No Bluesky profile exists for this user.
4242- #[error("error-smokesignal-profile-import-9 No Bluesky profile found")]
4343- NoBlueskyProfile,
4437}
···134134135135 // Build query params for pagination
136136 let mut params: Vec<(&str, String)> = vec![];
137137- if let Some(ref q) = search_query.query {
138138- if !q.is_empty() {
139139- params.push(("query", q.clone()));
140140- }
137137+ if let Some(ref q) = search_query.query
138138+ && !q.is_empty()
139139+ {
140140+ params.push(("query", q.clone()));
141141 }
142142143143 let params_refs: Vec<(&str, &str)> = params
+4-4
src/http/handle_admin_profile_index.rs
···134134135135 // Build query params for pagination
136136 let mut params: Vec<(&str, String)> = vec![];
137137- if let Some(ref q) = search_query.query {
138138- if !q.is_empty() {
139139- params.push(("query", q.clone()));
140140- }
137137+ if let Some(ref q) = search_query.query
138138+ && !q.is_empty()
139139+ {
140140+ params.push(("query", q.clone()));
141141 }
142142143143 let params_refs: Vec<(&str, &str)> = params
+29-31
src/http/handle_create_event.rs
···454454 }
455455456456 // Download and store header image from PDS if one was uploaded
457457- if let Some(ref header_cid) = build_event_form.header_cid {
458458- if let Err(err) = store_event_header_from_pds(
457457+ if let Some(ref header_cid) = build_event_form.header_cid
458458+ && let Err(err) = store_event_header_from_pds(
459459 &web_context.http_client,
460460 &web_context.content_storage,
461461 ¤t_handle.pds,
···463463 header_cid,
464464 )
465465 .await
466466- {
467467- tracing::warn!(
468468- ?err,
469469- cid = %header_cid,
470470- "Failed to store event header image from PDS"
471471- );
472472- // Don't fail the request - the event was created successfully
473473- // The header can be fetched later via jetstream or admin import
474474- }
466466+ {
467467+ tracing::warn!(
468468+ ?err,
469469+ cid = %header_cid,
470470+ "Failed to store event header image from PDS"
471471+ );
472472+ // Don't fail the request - the event was created successfully
473473+ // The header can be fetched later via jetstream or admin import
475474 }
476475477476 let event_url = url_from_aturi(
···574573 }
575574576575 // Validate end is after start
577577- if let (Some(start), Some(end)) = (starts_at, ends_at) {
578578- if end <= start {
579579- return Ok((
580580- StatusCode::BAD_REQUEST,
581581- Json(json!({
582582- "error": "End time must be after start time"
583583- }))
584584- ).into_response());
585585- }
576576+ if let (Some(start), Some(end)) = (starts_at, ends_at)
577577+ && end <= start
578578+ {
579579+ return Ok((
580580+ StatusCode::BAD_REQUEST,
581581+ Json(json!({
582582+ "error": "End time must be after start time"
583583+ }))
584584+ ).into_response());
586585 }
587586588587 // Parse mode
···792791 }
793792794793 // Download and store header image from PDS if one was uploaded
795795- if let Some(ref header_cid) = request.header_cid {
796796- if let Err(err) = store_event_header_from_pds(
794794+ if let Some(ref header_cid) = request.header_cid
795795+ && let Err(err) = store_event_header_from_pds(
797796 &web_context.http_client,
798797 &web_context.content_storage,
799798 ¤t_handle.pds,
···801800 header_cid,
802801 )
803802 .await
804804- {
805805- tracing::warn!(
806806- ?err,
807807- cid = %header_cid,
808808- "Failed to store event header image from PDS"
809809- );
810810- // Don't fail the request - the event was created successfully
811811- // The header can be fetched later via jetstream or admin import
812812- }
803803+ {
804804+ tracing::warn!(
805805+ ?err,
806806+ cid = %header_cid,
807807+ "Failed to store event header image from PDS"
808808+ );
809809+ // Don't fail the request - the event was created successfully
810810+ // The header can be fetched later via jetstream or admin import
813811 }
814812815813 let event_url = url_from_aturi(
+17-18
src/http/handle_edit_event.rs
···143143 };
144144145145 // Validate end after start
146146- if let (Some(start), Some(end)) = (starts_at, ends_at) {
147147- if end <= start {
148148- return Ok((
149149- StatusCode::BAD_REQUEST,
150150- Json(json!({"error": "End time must be after start time"}))
151151- ).into_response());
152152- }
146146+ if let (Some(start), Some(end)) = (starts_at, ends_at)
147147+ && end <= start
148148+ {
149149+ return Ok((
150150+ StatusCode::BAD_REQUEST,
151151+ Json(json!({"error": "End time must be after start time"}))
152152+ ).into_response());
153153 }
154154155155 // Parse mode and status
···363363 }
364364365365 // Download and store header image from PDS if one was uploaded
366366- if let Some(ref header_cid) = request.header_cid {
367367- if let Err(err) = store_event_header_from_pds(
366366+ if let Some(ref header_cid) = request.header_cid
367367+ && let Err(err) = store_event_header_from_pds(
368368 &ctx.web_context.http_client,
369369 &ctx.web_context.content_storage,
370370 ¤t_handle.pds,
···372372 header_cid,
373373 )
374374 .await
375375- {
376376- tracing::warn!(
377377- ?err,
378378- cid = %header_cid,
379379- "Failed to store event header image from PDS"
380380- );
381381- // Don't fail the request - the event was updated successfully
382382- // The header can be fetched later via jetstream or admin import
383383- }
375375+ {
376376+ tracing::warn!(
377377+ ?err,
378378+ cid = %header_cid,
379379+ "Failed to store event header image from PDS"
380380+ );
381381+ // Don't fail the request - the event was updated successfully
382382+ // The header can be fetched later via jetstream or admin import
384383 }
385384386385 let event_url = crate::http::utils::url_from_aturi(