nodebb-plugin-admin-chats 3.4.2 → 3.4.3

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.
Files changed (2) hide show
  1. package/client.js +13 -3
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -244,11 +244,21 @@ $(document).ready(function() {
244
244
  mainWrapper.find('[data-bs-toggle="tooltip"]').tooltip({ trigger: 'hover', container: '#content' });
245
245
  Chats.setActive(roomId);
246
246
  Chats.addEventListeners();
247
- // Pass the container like core does — listeners (e.g. the emoji
248
- // plugin's chat button) resolve elements relative to it
249
- $(window).trigger('action:chat.loaded', $('.chats-full'));
247
+ // Fire through the hooks module like core does — a raw jQuery
248
+ // trigger never reaches hooks.on() listeners (e.g. the reactions
249
+ // plugin), only legacy $(window).on() ones (e.g. the emoji plugin).
250
+ // hooks.fire invokes both kinds and passes the container.
251
+ require(['hooks'], function(hooks) {
252
+ hooks.fire('action:chat.loaded', $('.chats-full'));
253
+ });
250
254
  if (roomId) {
251
255
  ChatsMessages.scrollToBottomAfterImageLoad(mainWrapper.find('[component="chat/message/content"]'));
256
+ // Core only marks a room read when its list element carries the
257
+ // "unread" class — the admin list doesn't, so mark it explicitly
258
+ require(['api'], function(api) {
259
+ api.del(`/chats/${roomId}/state`, {}).catch(function() {});
260
+ });
261
+ $('[component="chat/nav-wrapper"]').find(`[data-roomid="${roomId}"]`).removeClass('unread');
252
262
  }
253
263
  if (history.pushState) {
254
264
  const fullUrl = `${window.location.protocol}//${window.location.host}${config.relative_path || ''}/${url}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-admin-chats",
3
- "version": "3.4.2",
3
+ "version": "3.4.3",
4
4
  "description": "A plugin that allows the administrator to view and manage user chats.",
5
5
  "main": "library.js",
6
6
  "nbbpm": {