From 5f64c6fe7551094aa3172a32016ba6548c03ad43 Mon Sep 17 00:00:00 2001 From: Maaxxs <61059039+MaaxxsDev@users.noreply.github.com> Date: Sat, 19 Sep 2026 07:12:34 +0200 Subject: [PATCH] Block moving members into locked groups in the raid editor Drag&drop moves and the underlying raid_move_action.php had no idea about locked_groups, so an admin could still drag a member into a group that was explicitly locked. Locked drop zones are now flagged in the markup, the frontend refuses the drag/drop, and the endpoint rejects the move server-side as well. Co-Authored-By: Claude Sonnet 5 --- assets/css/style.css | 19 +++++++++++++++++++ assets/js/raids.js | 6 ++++-- raid_move_action.php | 12 +++++++++++- raids.php | 6 +++--- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/assets/css/style.css b/assets/css/style.css index 7580764..f601fa7 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -153,6 +153,25 @@ a:hover { color: var(--gold-hover); text-decoration: underline; } .sidebar-user strong { color: var(--text); } +.avatar { + display: inline-block; + border-radius: 50%; + object-fit: cover; + flex-shrink: 0; + vertical-align: middle; +} + +.avatar-placeholder { + display: inline-flex; + align-items: center; + justify-content: center; + color: #fff; + font-weight: 700; + border: 1px solid rgba(255, 255, 255, 0.15); +} + +.hero .avatar { margin-bottom: 1rem; } + .app-content { flex: 1; min-width: 0; diff --git a/assets/js/raids.js b/assets/js/raids.js index eaf4301..af3dcbc 100644 --- a/assets/js/raids.js +++ b/assets/js/raids.js @@ -219,9 +219,11 @@ }); document.querySelectorAll('.raid-drop-zone').forEach(function (zone) { + var isLocked = zone.getAttribute('data-locked') === '1'; + zone.addEventListener('dragover', function (e) { var card = zone.closest('.raid-card'); - if (!card || !card.classList.contains('editing')) return; + if (!card || !card.classList.contains('editing') || isLocked) return; e.preventDefault(); zone.classList.add('drag-over'); }); @@ -232,7 +234,7 @@ e.preventDefault(); zone.classList.remove('drag-over'); var card = zone.closest('.raid-card'); - if (!card || !card.classList.contains('editing')) return; + if (!card || !card.classList.contains('editing') || isLocked) return; var raw = e.dataTransfer.getData('text/plain'); if (!raw) return; diff --git a/raid_move_action.php b/raid_move_action.php index dd82c73..c886c25 100644 --- a/raid_move_action.php +++ b/raid_move_action.php @@ -14,8 +14,18 @@ if ($raidId <= 0 || $discordId <= 0 || !is_numeric($group) || (int) $group < 0) json_response(false, 'Ungültige Anfrage.'); } +$group = (int) $group; + try { - move_signup($raidId, $discordId, (int) $group); + if ($group > 0) { + $raid = fetch_raid_by_id($raidId); + $lockedGroups = is_array($raid['locked_groups'] ?? null) ? array_map('intval', $raid['locked_groups']) : []; + if (in_array($group, $lockedGroups, true)) { + json_response(false, 'Diese Gruppe ist gesperrt.'); + } + } + + move_signup($raidId, $discordId, $group); json_response(true, 'Spieler wurde verschoben.'); } catch (Throwable $e) { json_response(false, 'Verschieben fehlgeschlagen: ' . $e->getMessage()); diff --git a/raids.php b/raids.php index 86c82ad..cfa2dcd 100644 --- a/raids.php +++ b/raids.php @@ -263,9 +263,9 @@ include __DIR__ . '/includes/header.php';
$groupName): ?> - -
-

()

+ +
+

()

Keine Anmeldungen