fix: positionnement des cartes selon les labels et mise à jour après édition
CI / test (push) Failing after 8s
CI / lint (push) Failing after 4s

- create_issue: utilise _issue_column() au lieu de hardcoder 'Backlog'
- update_issue_api: recalcule la colonne après changement de labels
- update_issue_api: utilise l'endpoint PUT /labels au lieu de PATCH (Gitea ignore labels dans PATCH)
- webhooks: utilise _issue_column() pour 'opened'/'reopened'
- saveIssueEdit: rafraîchit le board (HTMX) après édition au lieu de rouvrir la modale
- update_issue_labels: corrigé pour utiliser PUT /issues/{id}/labels (liste d'entiers)
This commit is contained in:
2026-07-08 11:27:56 -04:00
parent 6ca376a675
commit 7b2fa01b0a
4 changed files with 59 additions and 16 deletions
+5 -3
View File
@@ -10,6 +10,7 @@ from fastapi import APIRouter, Request, HTTPException
from app.config import settings
from app.db import get_conn
from app.routers.board import _issue_column
logger = logging.getLogger(__name__)
router = APIRouter(tags=["webhooks"], prefix="/api/webhook")
@@ -70,7 +71,7 @@ async def _handle_issue_event(payload: dict):
with get_conn() as conn:
board = conn.execute(
"SELECT id FROM boards WHERE project_owner=? AND project_name=?",
"SELECT id, columns_json FROM boards WHERE project_owner=? AND project_name=?",
(owner, repo_name),
).fetchone()
@@ -79,8 +80,9 @@ async def _handle_issue_event(payload: dict):
board_id = board["id"]
if action in ("opened", "reopened"):
# Add card to default column
column = "Backlog"
# Determine column from label mapping (fallback to first column)
columns = json.loads(board["columns_json"])
column = _issue_column(issue, columns, board_id)
conn.execute(
"""INSERT OR IGNORE INTO cards (board_id, gitea_issue_id, column_name, position)
VALUES (?, ?, ?, 0)""",