mirror of
https://github.com/Such-Software/smirk-backend-core.git
synced 2026-10-17 07:21:32 +02:00
chore: cargo fmt with rustfmt 1.9.0 (repo-wide)
CI gates on cargo fmt --all -- --check and it was already failing on main before
this branch: rustfmt 1.9.0 reformats three call chains that an older rustfmt
left alone. Same housekeeping as 586d29e.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
d9523de008
commit
c1539d96e7
+10
-2
@@ -268,7 +268,11 @@ pub async fn activate(
|
|||||||
|
|
||||||
// Just activated, so general posting is permitted regardless of policy; still
|
// Just activated, so general posting is permitted regardless of policy; still
|
||||||
// report the allowlist bit truthfully.
|
// report the allowlist bit truthfully.
|
||||||
let npub = state.db.get_user_by_id(user_id).await?.and_then(|u| u.nostr_pubkey);
|
let npub = state
|
||||||
|
.db
|
||||||
|
.get_user_by_id(user_id)
|
||||||
|
.await?
|
||||||
|
.and_then(|u| u.nostr_pubkey);
|
||||||
let (write_allowlisted, _) = general_posting_rights(&state, npub.as_deref());
|
let (write_allowlisted, _) = general_posting_rights(&state, npub.as_deref());
|
||||||
Ok(Json(StatusResp {
|
Ok(Json(StatusResp {
|
||||||
active: true,
|
active: true,
|
||||||
@@ -297,7 +301,11 @@ pub async fn status(
|
|||||||
let user_id = extract_user_id_from_token(&state, &headers).await?;
|
let user_id = extract_user_id_from_token(&state, &headers).await?;
|
||||||
let until = state.db.get_premium_until(user_id).await?;
|
let until = state.db.get_premium_until(user_id).await?;
|
||||||
let active = until.map(|u| u > chrono::Utc::now()).unwrap_or(false);
|
let active = until.map(|u| u > chrono::Utc::now()).unwrap_or(false);
|
||||||
let npub = state.db.get_user_by_id(user_id).await?.and_then(|u| u.nostr_pubkey);
|
let npub = state
|
||||||
|
.db
|
||||||
|
.get_user_by_id(user_id)
|
||||||
|
.await?
|
||||||
|
.and_then(|u| u.nostr_pubkey);
|
||||||
let (write_allowlisted, can_general) = general_posting_rights(&state, npub.as_deref());
|
let (write_allowlisted, can_general) = general_posting_rights(&state, npub.as_deref());
|
||||||
Ok(Json(StatusResp {
|
Ok(Json(StatusResp {
|
||||||
active,
|
active,
|
||||||
|
|||||||
+5
-1
@@ -239,7 +239,11 @@ impl SessionManager {
|
|||||||
Ok(TokenInfo {
|
Ok(TokenInfo {
|
||||||
user_id,
|
user_id,
|
||||||
platform: data.claims.platform,
|
platform: data.claims.platform,
|
||||||
session_id: data.claims.sid.as_deref().and_then(|s| Uuid::parse_str(s).ok()),
|
session_id: data
|
||||||
|
.claims
|
||||||
|
.sid
|
||||||
|
.as_deref()
|
||||||
|
.and_then(|s| Uuid::parse_str(s).ok()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,9 @@ impl Database {
|
|||||||
audit_days: u64,
|
audit_days: u64,
|
||||||
batch: i64,
|
batch: i64,
|
||||||
) -> Result<u64, AppError> {
|
) -> Result<u64, AppError> {
|
||||||
let logins = self.cleanup_old_login_events(login_events_days, batch).await?;
|
let logins = self
|
||||||
|
.cleanup_old_login_events(login_events_days, batch)
|
||||||
|
.await?;
|
||||||
let audits = self.cleanup_old_audit_logs(audit_days, batch).await?;
|
let audits = self.cleanup_old_audit_logs(audit_days, batch).await?;
|
||||||
let scrubbed = self.scrub_legacy_login_ip_hashes(batch).await?;
|
let scrubbed = self.scrub_legacy_login_ip_hashes(batch).await?;
|
||||||
if scrubbed > 0 {
|
if scrubbed > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user