diff options
| -rw-r--r-- | src/git/sync.rs | 3 | ||||
| -rw-r--r-- | src/nostr/policy/pr_event.rs | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/git/sync.rs b/src/git/sync.rs index a0b7c47..4b35023 100644 --- a/src/git/sync.rs +++ b/src/git/sync.rs | |||
| @@ -1171,6 +1171,9 @@ async fn process_purgatory_pr_events( | |||
| 1171 | ); | 1171 | ); |
| 1172 | 1172 | ||
| 1173 | // Fetch repository data for syncing | 1173 | // Fetch repository data for syncing |
| 1174 | // NOTE: Only fetch from database, NOT purgatory. PR events should only be | ||
| 1175 | // released from purgatory when the announcement has been promoted (validated). | ||
| 1176 | // This ensures we don't accept PR events for announcements that fail validation. | ||
| 1174 | let db_repo_data = match fetch_repository_data(database, identifier).await { | 1177 | let db_repo_data = match fetch_repository_data(database, identifier).await { |
| 1175 | Ok(data) => data, | 1178 | Ok(data) => data, |
| 1176 | Err(e) => { | 1179 | Err(e) => { |
diff --git a/src/nostr/policy/pr_event.rs b/src/nostr/policy/pr_event.rs index 00e09c3..072e445 100644 --- a/src/nostr/policy/pr_event.rs +++ b/src/nostr/policy/pr_event.rs | |||
| @@ -127,6 +127,10 @@ impl PrEventPolicy { | |||
| 127 | .ok_or_else(|| anyhow::anyhow!("No identifier in PR event"))?; | 127 | .ok_or_else(|| anyhow::anyhow!("No identifier in PR event"))?; |
| 128 | 128 | ||
| 129 | // Fetch repository data | 129 | // Fetch repository data |
| 130 | // NOTE: Only fetch from database, NOT purgatory. Incoming PR events should | ||
| 131 | // only be accepted for announcements that have been promoted (validated). | ||
| 132 | // If the announcement is still in purgatory, the PR event should also go | ||
| 133 | // to purgatory and wait for the announcement to be promoted. | ||
| 130 | let db_repo_data = fetch_repository_data(&self.ctx.database, &identifier).await?; | 134 | let db_repo_data = fetch_repository_data(&self.ctx.database, &identifier).await?; |
| 131 | 135 | ||
| 132 | // Extract owner pubkey from source repo path | 136 | // Extract owner pubkey from source repo path |
| @@ -203,6 +207,10 @@ impl PrEventPolicy { | |||
| 203 | let identifier = parts[2]; | 207 | let identifier = parts[2]; |
| 204 | 208 | ||
| 205 | // 2. Fetch repo data | 209 | // 2. Fetch repo data |
| 210 | // NOTE: Only fetch from database, NOT purgatory. Incoming PR events should | ||
| 211 | // only be accepted for announcements that have been promoted (validated). | ||
| 212 | // If the announcement is still in purgatory, the PR event should also go | ||
| 213 | // to purgatory and wait for the announcement to be promoted. | ||
| 206 | let db_repo_data = fetch_repository_data(&self.ctx.database, identifier).await?; | 214 | let db_repo_data = fetch_repository_data(&self.ctx.database, identifier).await?; |
| 207 | 215 | ||
| 208 | // 3. Extract list of maintainers from "a 30617:<maintainer>:<identifier>" tags | 216 | // 3. Extract list of maintainers from "a 30617:<maintainer>:<identifier>" tags |