fix: positionnement des cartes selon les labels et mise à jour après édition
- 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:
@@ -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)""",
|
||||
|
||||
Reference in New Issue
Block a user