forked from yvv/decision
v3 : publication — un envoi refusé repart, un dépôt neuf reçoit l'historique
Douzième relecture (850f9c4 : ok), défauts anciens de publish.rs mis en
jeu par le nouveau dépôt :
- un commit que le dépôt n'a jamais reçu (premier envoi refusé, clé sans
droit d'écriture) repart au passage suivant, au lieu d'une file marquée
faite avec un dépôt vide ;
- un changement de remote vers un dépôt neuf et vide lui envoie
l'historique ;
- au démarrage, ce qui attendait repart aussitôt (le délai croissant
pouvait atteindre 6 h).
trustinWallet montre l'état de la publication (en attente, dernier échec,
dernier commit) et offre « Publier maintenant ».
Boucle : 69 tests Rust, svelte-check, 9 vitest, e2e 13/13.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,10 +45,13 @@ pub async fn overview(State(state): State<AppState>, User(user): User) -> AppRes
|
||||
.bind(util::now())
|
||||
.fetch_all(&state.db)
|
||||
.await?;
|
||||
let publication = json!({
|
||||
let mut publication = json!({
|
||||
"remote": state.cfg.publish.as_ref().map(|p| p.remote.clone()),
|
||||
"publicKey": crate::publish::public_key(&state),
|
||||
});
|
||||
if state.cfg.publish.is_some() {
|
||||
publication["status"] = crate::publish::status(&state).await?;
|
||||
}
|
||||
Ok(Json(json!({
|
||||
"publication": publication,
|
||||
"groups": groups.iter().map(|(slug, name, policy, hidden)| json!({
|
||||
@@ -165,6 +168,18 @@ pub async fn cancel_invitation(
|
||||
Ok(Json(json!({ "ok": true })))
|
||||
}
|
||||
|
||||
/// « Publier maintenant » : a key just added, a remote just created — no need
|
||||
/// to wait for the backoff.
|
||||
pub async fn publish_now(State(state): State<AppState>, User(user): User) -> AppResult<Json<serde_json::Value>> {
|
||||
admin_only(&user)?;
|
||||
if state.cfg.publish.is_none() {
|
||||
return Err(AppError::Conflict("publication_off"));
|
||||
}
|
||||
crate::publish::retry_now(&state).await?;
|
||||
tracing::info!(by = %user.id, "publication retried now");
|
||||
Ok(Json(json!({ "ok": true })))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct AdminBody {
|
||||
admin: bool,
|
||||
|
||||
Reference in New Issue
Block a user