nodebb-plugin-mentions 4.7.6 → 4.8.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-mentions",
3
- "version": "4.7.6",
3
+ "version": "4.8.0",
4
4
  "description": "NodeBB Plugin that allows users to mention other users by prepending an '@' sign to their username",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -33,6 +33,6 @@
33
33
  "eslint": "^9.25.1",
34
34
  "eslint-config-nodebb": "^1.1.4",
35
35
  "eslint-plugin-import": "^2.31.0",
36
- "mocha": "11.2.2"
36
+ "mocha": "11.7.4"
37
37
  }
38
38
  }
@@ -64,6 +64,7 @@ $(document).ready(function () {
64
64
  }).sort(function (a, b) {
65
65
  return a.toLocaleLowerCase() > b.toLocaleLowerCase() ? 1 : -1;
66
66
  });
67
+
67
68
  // Add group mentions at the bottom of dropdown
68
69
  mentions = mentions.concat(groupMentions);
69
70
 
@@ -113,10 +114,24 @@ $(document).ready(function () {
113
114
  return carry;
114
115
  }
115
116
 
116
- // Format suggestions as 'avatar username/name (fullname)'
117
- const avatar = entry.uid ? helpers.buildAvatar(entry, '24px', true) : '';
118
- const fullname = entry.fullname ? `(${entry.fullname})` : '';
119
- carry.push(`${avatar} ${entry.username || entry.name} ${helpers.escape(fullname)}`);
117
+ // Format suggestions as 'avatar username/name (fullname/slug)'
118
+ switch(true) {
119
+ case entry.hasOwnProperty('uid'): {
120
+ const avatar = helpers.buildAvatar(entry, '24px', true);
121
+ const fullname = entry.fullname ? `(${entry.fullname})` : '';
122
+ carry.push(`${avatar} ${entry.username || entry.name} ${helpers.escape(fullname)}`);
123
+ break;
124
+ }
125
+
126
+ case entry.hasOwnProperty('cid'): {
127
+ const avatar = helpers.buildCategoryIcon(entry, '24px', 'rounded-circle');
128
+ carry.push(`${avatar} ${entry.name}${!utils.isNumber(entry.cid) ? ` (${entry.slug})` : ''}`);
129
+ break;
130
+ }
131
+
132
+ default:
133
+ carry.push(entry.name);
134
+ }
120
135
 
121
136
  return carry;
122
137
  }, []);