diff --git a/api_v1_roles.php b/api_v1_roles.php index efeecc3..2b2dd23 100644 --- a/api_v1_roles.php +++ b/api_v1_roles.php @@ -28,7 +28,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { // Fetch members and their roles $stmt = db()->prepare(" - SELECT u.id, u.display_name as username, u.username as login_name, u.avatar_url, + SELECT u.id, u.display_name as username, u.username as login_name, u.avatar_url, u.status, GROUP_CONCAT(DISTINCT r.id) as role_ids, GROUP_CONCAT(DISTINCT r.name) as role_names, (SELECT r2.color FROM roles r2 JOIN user_roles ur2 ON r2.id = ur2.role_id WHERE ur2.user_id = u.id AND r2.server_id = ? ORDER BY r2.position DESC LIMIT 1) as role_color, diff --git a/assets/js/main.js b/assets/js/main.js index 76da6e7..cea717f 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -889,23 +889,31 @@ document.addEventListener('DOMContentLoaded', () => { } function updatePresenceUI(userId, status) { - const memberItem = document.querySelector(`.start-dm-btn[data-user-id="${userId}"] .message-avatar`); - if (memberItem) { - let indicator = memberItem.querySelector('.presence-indicator'); - if (!indicator) { - indicator = document.createElement('div'); - indicator.className = 'presence-indicator'; - memberItem.appendChild(indicator); + const selectors = [ + `.start-dm-btn[data-user-id="${userId}"] .message-avatar`, + `.member-item[data-user-id="${userId}"] .message-avatar` + ]; + + selectors.forEach(selector => { + const container = document.querySelector(selector); + if (container) { + let indicator = container.querySelector('.presence-indicator'); + if (!indicator) { + indicator = document.createElement('div'); + indicator.className = 'presence-indicator'; + container.appendChild(indicator); + } + indicator.style.position = 'absolute'; + indicator.style.bottom = '0'; + indicator.style.right = '0'; + indicator.style.width = '10px'; + indicator.style.height = '10px'; + indicator.style.borderRadius = '50%'; + indicator.style.border = '2px solid var(--bg-members)'; + indicator.style.backgroundColor = status === 'online' ? '#23a559' : '#80848e'; + container.style.backgroundColor = status === 'online' ? '#23a559' : '#80848e'; } - indicator.style.position = 'absolute'; - indicator.style.bottom = '0'; - indicator.style.right = '0'; - indicator.style.width = '10px'; - indicator.style.height = '10px'; - indicator.style.borderRadius = '50%'; - indicator.style.border = '2px solid var(--bg-members)'; - indicator.style.backgroundColor = status === 'online' ? '#23a559' : '#80848e'; - } + }); } // Presence indicators initialization (can be expanded) @@ -1916,7 +1924,7 @@ document.addEventListener('DOMContentLoaded', () => { item.innerHTML = `