fix(planka): position obligatoire pour déplacer une carte + filtre listes None
Deploy HouseHub / deploy (push) Successful in 2s
Deploy HouseHub / deploy (push) Successful in 2s
- dropCard envoie position (max+65535) car Planka l'exige pour changer listId - Ajout vérification res.ok + toast d'erreur/succès - Filtre les listes avec name='None' (placeholders Planka sans nom) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
285273108c
commit
7d62aa02be
@@ -69,9 +69,10 @@ if ($action === 'board') {
|
|||||||
$resp = planka_api('GET', '/api/boards/' . $id, null, $token);
|
$resp = planka_api('GET', '/api/boards/' . $id, null, $token);
|
||||||
$inc = $resp['included'] ?? [];
|
$inc = $resp['included'] ?? [];
|
||||||
|
|
||||||
// Filter lists that actually belong to this board (prevents ghost lists from other boards)
|
// Filter: only lists with a real name (Planka creates unnamed "None" placeholder lists)
|
||||||
$lists = array_values(array_filter($inc['lists'] ?? [], fn($l) =>
|
$lists = array_values(array_filter($inc['lists'] ?? [], fn($l) =>
|
||||||
isset($l['boardId']) ? $l['boardId'] === $id : true
|
!empty($l['name']) && $l['name'] !== 'None' &&
|
||||||
|
(isset($l['boardId']) ? $l['boardId'] === $id : true)
|
||||||
));
|
));
|
||||||
// Filter cards that belong to a list in this board
|
// Filter cards that belong to a list in this board
|
||||||
$listIds = array_column($lists, 'id');
|
$listIds = array_column($lists, 'id');
|
||||||
|
|||||||
+8
-1
@@ -205,9 +205,16 @@ async function dropCard(listId) {
|
|||||||
if (!dragCardId) return;
|
if (!dragCardId) return;
|
||||||
const card = state.cards.find(c => c.id === dragCardId);
|
const card = state.cards.find(c => c.id === dragCardId);
|
||||||
if (!card || card.listId === listId) return;
|
if (!card || card.listId === listId) return;
|
||||||
await apiFetch('update_card', { id: dragCardId }, 'PATCH', { listId });
|
// Planka requires position when changing listId
|
||||||
|
const targetCards = state.cards.filter(c => c.listId === listId);
|
||||||
|
const maxPos = targetCards.reduce((m, c) => Math.max(m, c.position || 0), 0);
|
||||||
|
const position = maxPos + 65535;
|
||||||
|
const res = await apiFetch('update_card', { id: dragCardId }, 'PATCH', { listId, position });
|
||||||
|
if (!res.ok) { showToast('Erreur déplacement : ' + (res.error || 'inconnu'), 'error'); return; }
|
||||||
card.listId = listId;
|
card.listId = listId;
|
||||||
|
card.position = position;
|
||||||
renderBoard();
|
renderBoard();
|
||||||
|
showToast('Carte déplacée');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function quickAddCard(listId) {
|
async function quickAddCard(listId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user