nodebb-plugin-admin-chats 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -1,14 +1,10 @@
1
1
  $(document).ready(function() {
2
- console.log(`[admin-chats] Client script loaded`);
3
2
 
4
3
  // Initialize translations object if not already set
5
4
  if (!window.adminChatsTranslations) {
6
5
  window.adminChatsTranslations = {};
7
6
  }
8
7
 
9
- console.log(`[admin-chats] ajaxify.data:`, ajaxify.data);
10
- console.log(`[admin-chats] window.adminChatsTranslations:`, window.adminChatsTranslations);
11
- console.log(`[admin-chats] window.adminChatsLanguage:`, window.adminChatsLanguage);
12
8
 
13
9
  // Get translations from ajaxify.data if available
14
10
  if (ajaxify.data && ajaxify.data.adminChatsTranslations) {
@@ -17,7 +13,6 @@ $(document).ready(function() {
17
13
  window.adminChatsAccess = ajaxify.data.adminChatsAccess;
18
14
  window.adminChatsIsAdmin = ajaxify.data.adminChatsIsAdmin;
19
15
  window.adminChatsCanManage = ajaxify.data.adminChatsCanManage;
20
- console.log(`[admin-chats] Loaded translations from ajaxify.data`);
21
16
  }
22
17
 
23
18
  syncAdminAccessFromAjaxify();
@@ -31,8 +26,6 @@ $(document).ready(function() {
31
26
  return window.adminChatsTranslations[key];
32
27
  }
33
28
  // If translation not found, log warning and return the key itself
34
- console.warn(`[admin-chats] Translation not found for key: ${key}`);
35
- console.log(`[admin-chats] Available translations:`, window.adminChatsTranslations);
36
29
  return key;
37
30
  }
38
31
 
@@ -298,7 +291,18 @@ $(document).ready(function() {
298
291
  }
299
292
 
300
293
  function getChatWindows() {
301
- return $('[component="chat/message/window"]');
294
+ const windows = new Set($('[component="chat/message/window"]').toArray());
295
+ $('.chat-modal').each(function() {
296
+ const $modal = $(this);
297
+ const nested = $modal.find('[component="chat/message/window"]').toArray();
298
+ if (nested.length) {
299
+ nested.forEach(el => windows.delete(el));
300
+ windows.add(this);
301
+ } else {
302
+ windows.add(this);
303
+ }
304
+ });
305
+ return $(Array.from(windows));
302
306
  }
303
307
 
304
308
  function getWindowRoomId($window) {
package/library.js CHANGED
@@ -30,13 +30,11 @@ function loadTranslations() {
30
30
  for (const dir of possiblePaths) {
31
31
  if (fs.existsSync(dir)) {
32
32
  languagesDir = dir;
33
- console.log(`[admin-chats] Found languages directory at: ${languagesDir}`);
34
33
  break;
35
34
  }
36
35
  }
37
36
 
38
37
  if (!languagesDir) {
39
- console.warn(`[admin-chats] Languages directory not found in any of these paths:`, possiblePaths);
40
38
  return;
41
39
  }
42
40
 
@@ -48,7 +46,6 @@ function loadTranslations() {
48
46
  if (fs.existsSync(langPath)) {
49
47
  const content = fs.readFileSync(langPath, 'utf8');
50
48
  translations[lang] = JSON.parse(content);
51
- console.log(`[admin-chats] Loaded translations for language: ${lang}`);
52
49
  }
53
50
  } catch (err) {
54
51
  console.error(`[admin-chats] Error loading translations for ${lang}:`, err.message);
@@ -241,20 +238,13 @@ plugin.filterUserNotificationsGetNotifications = async function (data) {
241
238
  return data;
242
239
  };
243
240
  async function buildAdminChatsClientContext(req) {
244
- console.log(`[admin-chats] addScripts hook called`);
245
241
  const uid = req && req.uid;
246
- console.log(`[admin-chats] addScripts called with uid: ${uid}`);
247
242
 
248
243
  let userLang = 'en-GB';
249
244
 
250
245
  if (uid) {
251
246
  try {
252
247
  const userData = await User.getUserData(uid);
253
- console.log(`[admin-chats] Full userData:`, userData);
254
- console.log(`[admin-chats] User data for uid ${uid}:`, {
255
- userLang: userData && userData.userLang,
256
- settingsUserLang: userData && userData.settings && userData.settings.userLang,
257
- });
258
248
 
259
249
  // Try different ways to get user language
260
250
  userLang = userData && userData.userLang;
@@ -265,7 +255,6 @@ async function buildAdminChatsClientContext(req) {
265
255
  // If user doesn't have specific language setting, use forum default
266
256
  if (!userLang) {
267
257
  userLang = meta.config.defaultLang || 'en-GB';
268
- console.log(`[admin-chats] Using forum default language: ${userLang}`);
269
258
  }
270
259
  } catch (err) {
271
260
  console.error(`[admin-chats] Error getting user language:`, err.message);
@@ -274,41 +263,31 @@ async function buildAdminChatsClientContext(req) {
274
263
  } else {
275
264
  // No uid, use forum default language
276
265
  userLang = meta.config.defaultLang || 'en-GB';
277
- console.log(`[admin-chats] No uid, using forum default language: ${userLang}`);
278
266
  }
279
267
 
280
268
  // Build translations based on user language from loaded files
281
269
  let clientTranslations = {};
282
270
  const langCode = userLang.split('-')[0];
283
271
 
284
- console.log(`[admin-chats] Forum default language: ${meta.config.defaultLang}`);
285
- console.log(`[admin-chats] User language: ${userLang}, Language code: ${langCode}`);
286
- console.log(`[admin-chats] Available translations:`, Object.keys(translations));
287
272
 
288
273
  // Try to get translations from loaded files
289
274
  // First try exact match (e.g., 'he-IL')
290
275
  if (translations[userLang]) {
291
276
  clientTranslations = translations[userLang];
292
- console.log(`[admin-chats] Using exact match: ${userLang}`);
293
277
  }
294
278
  // Then try language code (e.g., 'he' from 'he-IL')
295
279
  else if (translations[langCode]) {
296
280
  clientTranslations = translations[langCode];
297
- console.log(`[admin-chats] Using language code: ${langCode}`);
298
281
  }
299
282
  // Then try full locale (e.g., 'en-GB')
300
283
  else if (translations[userLang.replace('-', '-')]) {
301
284
  clientTranslations = translations[userLang];
302
- console.log(`[admin-chats] Using full locale: ${userLang}`);
303
285
  }
304
286
  // Fallback to English
305
287
  else {
306
288
  clientTranslations = translations['en'] || translations['en-GB'] || {};
307
- console.log(`[admin-chats] Using fallback (en or en-GB)`);
308
289
  }
309
290
 
310
- console.log(`[admin-chats] Sending translations:`, Object.keys(clientTranslations));
311
- console.log(`[admin-chats] clientTranslations content:`, clientTranslations);
312
291
 
313
292
  const isAdmin = uid ? await User.isAdministrator(uid) : false;
314
293
  const adminChatsManage = uid ? (isAdmin || await privileges.global.can(ADMIN_CHATS_MANAGE_PRIVILEGE, uid)) : false;
@@ -336,7 +315,6 @@ plugin.addTemplateData = async function (data) {
336
315
  templateData.adminChatsIsAdmin = context.adminChatsIsAdmin;
337
316
  templateData.adminChatsCanManage = context.adminChatsCanManage;
338
317
 
339
- console.log(`[admin-chats] Added translations to template data`);
340
318
  return data;
341
319
  };
342
320
 
@@ -358,7 +336,6 @@ plugin.addScripts = async function (data) {
358
336
  script: scriptContent
359
337
  });
360
338
 
361
- console.log(`[admin-chats] Added translations to data object and scripts`);
362
339
 
363
340
  return data;
364
341
  };
@@ -1248,3 +1225,4 @@ module.exports = plugin;
1248
1225
 
1249
1226
 
1250
1227
 
1228
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-admin-chats",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "A plugin that allows the administrator to view and manage user chats.",
5
5
  "main": "library.js",
6
6
  "nbbpm": {
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 تم قفل هذه الغرفة من قبل المسؤولين.",
3
+ "menu.lock": "قفل الغرفة",
4
+ "menu.release": "إزالة القفل",
5
+ "errors.update": "تعذر تحديث قفل الغرفة.",
6
+ "profile.viewChats": "عرض الدردشات",
7
+ "empty.selectChat": "يرجى اختيار دردشة من الشريط الجانبي.",
8
+ "errors.lockedAction": "لا يمكن تنفيذ هذا الإجراء في غرفة مقفلة.",
9
+ "admin-chats-view": "عرض جميع الدردشات",
10
+ "admin-chats-manage": "إدارة غرف الدردشة",
11
+ "participants": "المشاركون"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Dieser Raum wurde von den Administratoren gesperrt.",
3
+ "menu.lock": "Raum sperren",
4
+ "menu.release": "Sperre aufheben",
5
+ "errors.update": "Raumsperre konnte nicht aktualisiert werden.",
6
+ "profile.viewChats": "Chats ansehen",
7
+ "empty.selectChat": "Bitte wählen Sie einen Chat in der Seitenleiste aus.",
8
+ "errors.lockedAction": "Diese Aktion kann in einem gesperrten Raum nicht ausgeführt werden.",
9
+ "admin-chats-view": "Alle Chats ansehen",
10
+ "admin-chats-manage": "Chat-Räume verwalten",
11
+ "participants": "Teilnehmer"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Dieser Raum wurde von den Administratoren gesperrt.",
3
+ "menu.lock": "Raum sperren",
4
+ "menu.release": "Sperre aufheben",
5
+ "errors.update": "Raumsperre konnte nicht aktualisiert werden.",
6
+ "profile.viewChats": "Chats ansehen",
7
+ "empty.selectChat": "Bitte wählen Sie einen Chat in der Seitenleiste aus.",
8
+ "errors.lockedAction": "Diese Aktion kann in einem gesperrten Raum nicht ausgeführt werden.",
9
+ "admin-chats-view": "Alle Chats ansehen",
10
+ "admin-chats-manage": "Chat-Räume verwalten",
11
+ "participants": "Teilnehmer"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Αυτό το δωμάτιο κλειδώθηκε από τους διαχειριστές.",
3
+ "menu.lock": "Κλείδωμα δωματίου",
4
+ "menu.release": "Άρση κλειδώματος",
5
+ "errors.update": "Δεν ήταν δυνατή η ενημέρωση του κλειδώματος του δωματίου.",
6
+ "profile.viewChats": "Προβολή συνομιλιών",
7
+ "empty.selectChat": "Παρακαλώ επιλέξτε μια συνομιλία από την πλαϊνή μπάρα.",
8
+ "errors.lockedAction": "Αυτή η ενέργεια δεν μπορεί να εκτελεστεί σε κλειδωμένο δωμάτιο.",
9
+ "admin-chats-view": "Προβολή όλων των συνομιλιών",
10
+ "admin-chats-manage": "Διαχείριση δωματίων συνομιλίας",
11
+ "participants": "Συμμετέχοντες"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Esta sala fue bloqueada por los administradores.",
3
+ "menu.lock": "Bloquear sala",
4
+ "menu.release": "Liberar bloqueo",
5
+ "errors.update": "No se pudo actualizar el bloqueo de la sala.",
6
+ "profile.viewChats": "Ver chats",
7
+ "empty.selectChat": "Seleccione un chat de la barra lateral.",
8
+ "errors.lockedAction": "Esta acción no se puede realizar en una sala bloqueada.",
9
+ "admin-chats-view": "Ver todos los chats",
10
+ "admin-chats-manage": "Administrar salas de chat",
11
+ "participants": "Participantes"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Cette salle a été verrouillée par les administrateurs.",
3
+ "menu.lock": "Verrouiller la salle",
4
+ "menu.release": "Déverrouiller",
5
+ "errors.update": "Impossible de mettre à jour le verrouillage de la salle.",
6
+ "profile.viewChats": "Voir les discussions",
7
+ "empty.selectChat": "Veuillez sélectionner une discussion dans la barre latérale.",
8
+ "errors.lockedAction": "Cette action ne peut pas être effectuée dans une salle verrouillée.",
9
+ "admin-chats-view": "Voir toutes les discussions",
10
+ "admin-chats-manage": "Gérer les salons de discussion",
11
+ "participants": "Participants"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 इस कमरे को प्रशासकों द्वारा लॉक किया गया था।",
3
+ "menu.lock": "कमरा लॉक करें",
4
+ "menu.release": "लॉक हटाएं",
5
+ "errors.update": "कमरे का लॉक अपडेट नहीं हो सका।",
6
+ "profile.viewChats": "चैट देखें",
7
+ "empty.selectChat": "कृपया साइडबार से एक चैट चुनें।",
8
+ "errors.lockedAction": "लॉक किए गए कमरे में यह कार्रवाई नहीं की जा सकती।",
9
+ "admin-chats-view": "सभी चैट देखें",
10
+ "admin-chats-manage": "चैट रूम प्रबंधित करें",
11
+ "participants": "प्रतिभागी"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Questa stanza è stata bloccata dagli amministratori.",
3
+ "menu.lock": "Blocca stanza",
4
+ "menu.release": "Rimuovi blocco",
5
+ "errors.update": "Impossibile aggiornare il blocco della stanza.",
6
+ "profile.viewChats": "Visualizza chat",
7
+ "empty.selectChat": "Seleziona una chat dalla barra laterale.",
8
+ "errors.lockedAction": "Questa azione non può essere eseguita in una stanza bloccata.",
9
+ "admin-chats-view": "Visualizza tutte le chat",
10
+ "admin-chats-manage": "Gestisci le stanze di chat",
11
+ "participants": "Partecipanti"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Questa stanza è stata bloccata dagli amministratori.",
3
+ "menu.lock": "Blocca stanza",
4
+ "menu.release": "Rimuovi blocco",
5
+ "errors.update": "Impossibile aggiornare il blocco della stanza.",
6
+ "profile.viewChats": "Visualizza chat",
7
+ "empty.selectChat": "Seleziona una chat dalla barra laterale.",
8
+ "errors.lockedAction": "Questa azione non può essere eseguita in una stanza bloccata.",
9
+ "admin-chats-view": "Visualizza tutte le chat",
10
+ "admin-chats-manage": "Gestisci le stanze di chat",
11
+ "participants": "Partecipanti"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 このルームは管理者によってロックされました。",
3
+ "menu.lock": "ルームをロック",
4
+ "menu.release": "ロック解除",
5
+ "errors.update": "ルームのロックを更新できませんでした。",
6
+ "profile.viewChats": "チャットを見る",
7
+ "empty.selectChat": "サイドバーからチャットを選択してください。",
8
+ "errors.lockedAction": "ロックされたルームではこの操作は実行できません。",
9
+ "admin-chats-view": "すべてのチャットを見る",
10
+ "admin-chats-manage": "チャットルームを管理",
11
+ "participants": "参加者"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Deze chatruimte is door de beheerders vergrendeld.",
3
+ "menu.lock": "Chatruimte vergrendelen",
4
+ "menu.release": "Vergrendeling opheffen",
5
+ "errors.update": "Kon de vergrendeling van de chatruimte niet bijwerken.",
6
+ "profile.viewChats": "Chats bekijken",
7
+ "empty.selectChat": "Selecteer een chat in de zijbalk.",
8
+ "errors.lockedAction": "Deze actie kan niet worden uitgevoerd in een vergrendelde chatruimte.",
9
+ "admin-chats-view": "Alle chats bekijken",
10
+ "admin-chats-manage": "Chatruimtes beheren",
11
+ "participants": "Deelnemers"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Ten pokój został zablokowany przez administratorów.",
3
+ "menu.lock": "Zablokuj pokój",
4
+ "menu.release": "Odblokuj",
5
+ "errors.update": "Nie udało się zaktualizować blokady pokoju.",
6
+ "profile.viewChats": "Wyświetl czaty",
7
+ "empty.selectChat": "Wybierz czat z paska bocznego.",
8
+ "errors.lockedAction": "Tej czynności nie można wykonać w zablokowanym pokoju.",
9
+ "admin-chats-view": "Wyświetl wszystkie czaty",
10
+ "admin-chats-manage": "Zarządzaj pokojami czatu",
11
+ "participants": "Uczestnicy"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Esta sala foi bloqueada pelos administradores.",
3
+ "menu.lock": "Bloquear sala",
4
+ "menu.release": "Desbloquear sala",
5
+ "errors.update": "Não foi possível atualizar o bloqueio da sala.",
6
+ "profile.viewChats": "Ver chats",
7
+ "empty.selectChat": "Selecione um chat na barra lateral.",
8
+ "errors.lockedAction": "Esta ação não pode ser realizada em uma sala bloqueada.",
9
+ "admin-chats-view": "Ver todos os chats",
10
+ "admin-chats-manage": "Gerenciar salas de chat",
11
+ "participants": "Participantes"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Quest locals è vegnì bloccà dals administraturs.",
3
+ "menu.lock": "Bloccar il local",
4
+ "menu.release": "Levà il bloc",
5
+ "errors.update": "Impussibel d'actualisar il bloc dal local.",
6
+ "profile.viewChats": "Veser chats",
7
+ "empty.selectChat": "Per plaschair tscherna in chat en la trav laterala.",
8
+ "errors.lockedAction": "Questa acziun na po betg vegnir fatga en in local bloccà.",
9
+ "admin-chats-view": "Veser tut ils chats",
10
+ "admin-chats-manage": "Administrar locals da chat",
11
+ "participants": "Participonts"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Эта комната была заблокирована администраторами.",
3
+ "menu.lock": "Заблокировать комнату",
4
+ "menu.release": "Снять блокировку",
5
+ "errors.update": "Не удалось обновить блокировку комнаты.",
6
+ "profile.viewChats": "Просмотреть чаты",
7
+ "empty.selectChat": "Пожалуйста, выберите чат на боковой панели.",
8
+ "errors.lockedAction": "Это действие нельзя выполнить в заблокированной комнате.",
9
+ "admin-chats-view": "Просмотреть все чаты",
10
+ "admin-chats-manage": "Управлять чат-комнатами",
11
+ "participants": "Участники"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 Ця кімната заблокована адміністратором.",
3
+ "menu.lock": "Заблокувати кімнату",
4
+ "menu.release": "Зняти блокування",
5
+ "errors.update": "Не вдалося оновити блокування кімнати.",
6
+ "profile.viewChats": "Переглянути Чати",
7
+ "empty.selectChat": "Оберіть чат з сайдбару, будь ласка.",
8
+ "errors.lockedAction": "Цю дію не можна виконати в блокованій кімнаті.",
9
+ "admin-chats-view": "Переглянути всі чати",
10
+ "admin-chats-manage": "Керувати чат-кімнатами",
11
+ "participants": "Учасники"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 此聊天室已被管理员锁定。",
3
+ "menu.lock": "锁定聊天室",
4
+ "menu.release": "解除锁定",
5
+ "errors.update": "无法更新聊天室锁定状态。",
6
+ "profile.viewChats": "查看聊天",
7
+ "empty.selectChat": "请从侧边栏选择一个聊天。",
8
+ "errors.lockedAction": "锁定的聊天室无法执行此操作。",
9
+ "admin-chats-view": "查看所有聊天",
10
+ "admin-chats-manage": "管理聊天室",
11
+ "participants": "参与者"
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "lock.banner": "🔒 此聊天室已被管理員鎖定。",
3
+ "menu.lock": "鎖定聊天室",
4
+ "menu.release": "解除鎖定",
5
+ "errors.update": "無法更新聊天室鎖定狀態。",
6
+ "profile.viewChats": "查看聊天",
7
+ "empty.selectChat": "請從側邊欄選擇一個聊天。",
8
+ "errors.lockedAction": "鎖定的聊天室無法執行此操作。",
9
+ "admin-chats-view": "查看所有聊天",
10
+ "admin-chats-manage": "管理聊天室",
11
+ "participants": "參與者"
12
+ }