upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-17 10:58:01 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-17 10:58:01 +0000
commitefbbcc49ae8e8f598a24c939b35ad9cda0541663 (patch)
tree788fd397862a61ef9d56aea46666bc36c583b504 /src
parente922e14e3ec4b898c111b2100cd63dddbe2fcdb1 (diff)
fix: include purgatory announcements in state event authorization
When processing state events from purgatory, we need to check authorization against announcements that may still be in purgatory (not yet promoted to the database). Previously, process_purgatory_state_events() used fetch_repository_data() which only queries the database. This caused authorization failures when: 1. Git data arrives 2. Announcement is promoted from purgatory to database 3. State events are processed from purgatory 4. But db_repo_data was fetched BEFORE the announcement promotion Now uses fetch_repository_data_with_purgatory() to include both database and purgatory announcements, ensuring authorization works correctly regardless of promotion timing.
Diffstat (limited to 'src')
-rw-r--r--src/git/sync.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/git/sync.rs b/src/git/sync.rs
index 13f30b6..a0b7c47 100644
--- a/src/git/sync.rs
+++ b/src/git/sync.rs
@@ -37,7 +37,8 @@ use tracing::{debug, info, warn};
37use nostr_sdk::Event; 37use nostr_sdk::Event;
38 38
39use crate::git::authorization::{ 39use crate::git::authorization::{
40 collect_authorized_maintainers, fetch_repository_data, RepositoryData, 40 collect_authorized_maintainers, fetch_repository_data, fetch_repository_data_with_purgatory,
41 RepositoryData,
41}; 42};
42use crate::git::{self, oid_exists}; 43use crate::git::{self, oid_exists};
43use crate::nostr::builder::SharedDatabase; 44use crate::nostr::builder::SharedDatabase;
@@ -923,7 +924,10 @@ async fn process_purgatory_state_events(
923 ); 924 );
924 925
925 // Fetch repository data once for all state events 926 // Fetch repository data once for all state events
926 let mut db_repo_data = match fetch_repository_data(database, identifier).await { 927 // IMPORTANT: Use fetch_repository_data_with_purgatory to include announcements
928 // that may still be in purgatory (not yet promoted). This ensures authorization
929 // works correctly even if the announcement promotion happens in the same batch.
930 let mut db_repo_data = match fetch_repository_data_with_purgatory(database, purgatory, identifier).await {
927 Ok(data) => data, 931 Ok(data) => data,
928 Err(e) => { 932 Err(e) => {
929 warn!( 933 warn!(