nodebb-plugin-mentions 4.8.0 → 4.8.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.
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "mentions": "提到",
3
- "user-mentioned-you-in": "<strong>%1</strong> 在 <strong>%2</strong> 中提到了你",
3
+ "user-mentioned-you-in": "<strong>%1</strong> 在 <strong>%2</strong> 中提到了您",
4
+ "user-mentioned-you-in-room": "<strong>%1</strong> 在 <strong class=\"text-nowrap\"><i class=\"fa %2\"></i>%3</strong> 中提到了您",
4
5
  "user-mentioned-group-in": "<strong>%1</strong> 在 <strong>%3</strong> 中提到了 <strong>%2</strong>",
5
- "notificationType_mention": "当有人提到你时"
6
+ "notificationType_mention": "当有人提到您时"
6
7
  }
package/library.js CHANGED
@@ -360,11 +360,17 @@ Mentions.getMatches = async (content) => {
360
360
  // Exported method only accepts markdown, also filters out dupes and matches to ensure slugs exist
361
361
  let { matches } = await getMatches(content, true);
362
362
  matches = await filterMatches(matches);
363
+ if (!matches.length) {
364
+ return new Set();
365
+ }
366
+
363
367
  const normalized = matches.map(match => match.slice(1).toLowerCase());
364
- const [uids, cids] = await Promise.all([
368
+ let [uids, localCids, remoteCids] = await Promise.all([
365
369
  User.getUidsByUserslugs(normalized),
366
370
  db.sortedSetScores('categoryhandle:cid', normalized),
371
+ db.getObjectFields('handle:cid', normalized),
367
372
  ]);
373
+ remoteCids = Object.values(remoteCids);
368
374
 
369
375
  matches = matches.map((slug, idx) => {
370
376
  if (uids[idx]) {
@@ -373,10 +379,10 @@ Mentions.getMatches = async (content) => {
373
379
  id: uids[idx],
374
380
  slug,
375
381
  };
376
- } else if (cids[idx]) {
382
+ } else if (localCids[idx] || remoteCids[idx]) {
377
383
  return {
378
384
  type: 'cid',
379
- id: cids[idx],
385
+ id: localCids[idx] || remoteCids[idx],
380
386
  slug,
381
387
  };
382
388
  }
@@ -389,9 +395,11 @@ Mentions.getMatches = async (content) => {
389
395
 
390
396
  async function filterMatches(matches) {
391
397
  matches = Array.from(new Set(matches));
392
- const exists = await meta.userOrGroupExists(matches.map(match => match.slice(1)));
398
+ const slugs = matches.map(match => match.slice(1));
399
+ const exists = await meta.slugTaken(slugs);
400
+ const remoteCidExists = await db.isObjectFields('handle:cid', slugs);
393
401
 
394
- return matches.filter((m, i) => exists[[i]]);
402
+ return matches.filter((m, i) => exists[i] || remoteCidExists[i]);
395
403
  }
396
404
 
397
405
  Mentions.parseRaw = async (content, type = 'default') => {
@@ -489,7 +497,7 @@ Mentions.parseRaw = async (content, type = 'default') => {
489
497
  if (type === 'markdown') {
490
498
  str = `[${match}](${nconf.get('url')}${url})`;
491
499
  } else {
492
- str = `<a class="plugin-mentions-${mentionType} plugin-mentions-a" href="${nconf.get('relative_path')}${url}">${!Mentions._settings.display ? '@' : ''}<bdi>${match}</bdi></a>`;
500
+ str = `<a class="plugin-mentions-${mentionType} plugin-mentions-a" href="${nconf.get('relative_path')}${url}" aria-label="Profile: ${match}">${!Mentions._settings.display ? '@' : ''}<bdi>${match}</bdi></a>`;
493
501
  }
494
502
 
495
503
  return plain + str;
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "nodebb-plugin-mentions",
3
- "version": "4.8.0",
3
+ "version": "4.8.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "nodebb-plugin-mentions",
9
- "version": "4.8.0",
9
+ "version": "4.8.2",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "html-entities": "^2.3.2",
@@ -17,7 +17,7 @@
17
17
  "eslint": "^9.25.1",
18
18
  "eslint-config-nodebb": "^1.1.4",
19
19
  "eslint-plugin-import": "^2.31.0",
20
- "mocha": "11.7.4"
20
+ "mocha": "11.7.5"
21
21
  }
22
22
  },
23
23
  "node_modules/@eslint-community/eslint-utils": {
@@ -61,13 +61,13 @@
61
61
  }
62
62
  },
63
63
  "node_modules/@eslint/config-array": {
64
- "version": "0.21.0",
65
- "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.0.tgz",
66
- "integrity": "sha512-ENIdc4iLu0d93HeYirvKmrzshzofPw6VkZRKQGe9Nv46ZnWUzcF1xV01dcvEg/1wXUR61OmmlSfyeyO7EvjLxQ==",
64
+ "version": "0.21.1",
65
+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz",
66
+ "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==",
67
67
  "dev": true,
68
68
  "license": "Apache-2.0",
69
69
  "dependencies": {
70
- "@eslint/object-schema": "^2.1.6",
70
+ "@eslint/object-schema": "^2.1.7",
71
71
  "debug": "^4.3.1",
72
72
  "minimatch": "^3.1.2"
73
73
  },
@@ -76,22 +76,22 @@
76
76
  }
77
77
  },
78
78
  "node_modules/@eslint/config-helpers": {
79
- "version": "0.4.0",
80
- "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.0.tgz",
81
- "integrity": "sha512-WUFvV4WoIwW8Bv0KeKCIIEgdSiFOsulyN0xrMu+7z43q/hkOLXjvb5u7UC9jDxvRzcrbEmuZBX5yJZz1741jog==",
79
+ "version": "0.4.2",
80
+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz",
81
+ "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==",
82
82
  "dev": true,
83
83
  "license": "Apache-2.0",
84
84
  "dependencies": {
85
- "@eslint/core": "^0.16.0"
85
+ "@eslint/core": "^0.17.0"
86
86
  },
87
87
  "engines": {
88
88
  "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
89
89
  }
90
90
  },
91
91
  "node_modules/@eslint/core": {
92
- "version": "0.16.0",
93
- "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.16.0.tgz",
94
- "integrity": "sha512-nmC8/totwobIiFcGkDza3GIKfAw1+hLiYVrh3I1nIomQ8PEr5cxg34jnkmGawul/ep52wGRAcyeDCNtWKSOj4Q==",
92
+ "version": "0.17.0",
93
+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz",
94
+ "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==",
95
95
  "dev": true,
96
96
  "license": "Apache-2.0",
97
97
  "dependencies": {
@@ -125,12 +125,11 @@
125
125
  }
126
126
  },
127
127
  "node_modules/@eslint/js": {
128
- "version": "9.37.0",
129
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.37.0.tgz",
130
- "integrity": "sha512-jaS+NJ+hximswBG6pjNX0uEJZkrT0zwpVi3BA3vX22aFGjJjmgSTSmPpZCRKmoBL5VY/M6p0xsSJx7rk7sy5gg==",
128
+ "version": "9.39.1",
129
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz",
130
+ "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==",
131
131
  "dev": true,
132
132
  "license": "MIT",
133
- "peer": true,
134
133
  "engines": {
135
134
  "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
136
135
  },
@@ -139,9 +138,9 @@
139
138
  }
140
139
  },
141
140
  "node_modules/@eslint/object-schema": {
142
- "version": "2.1.6",
143
- "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz",
144
- "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==",
141
+ "version": "2.1.7",
142
+ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz",
143
+ "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==",
145
144
  "dev": true,
146
145
  "license": "Apache-2.0",
147
146
  "engines": {
@@ -149,13 +148,13 @@
149
148
  }
150
149
  },
151
150
  "node_modules/@eslint/plugin-kit": {
152
- "version": "0.4.0",
153
- "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.0.tgz",
154
- "integrity": "sha512-sB5uyeq+dwCWyPi31B2gQlVlo+j5brPlWx4yZBrEaRo/nhdDE8Xke1gsGgtiBdaBTxuTkceLVuVt/pclrasb0A==",
151
+ "version": "0.4.1",
152
+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz",
153
+ "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==",
155
154
  "dev": true,
156
155
  "license": "Apache-2.0",
157
156
  "dependencies": {
158
- "@eslint/core": "^0.16.0",
157
+ "@eslint/core": "^0.17.0",
159
158
  "levn": "^0.4.1"
160
159
  },
161
160
  "engines": {
@@ -303,6 +302,7 @@
303
302
  "integrity": "sha512-wzkUfX3plUqij4YwWaJyqhiPE5UCRVlFpKn1oCRn2O1bJ592XxWJj8ROQ3JD5MYXLORW84063z3tZTb/cs4Tyw==",
304
303
  "dev": true,
305
304
  "license": "MIT",
305
+ "peer": true,
306
306
  "engines": {
307
307
  "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
308
308
  },
@@ -317,7 +317,6 @@
317
317
  "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
318
318
  "dev": true,
319
319
  "license": "MIT",
320
- "peer": true,
321
320
  "bin": {
322
321
  "acorn": "bin/acorn"
323
322
  },
@@ -1089,26 +1088,24 @@
1089
1088
  }
1090
1089
  },
1091
1090
  "node_modules/eslint": {
1092
- "version": "9.37.0",
1093
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.37.0.tgz",
1094
- "integrity": "sha512-XyLmROnACWqSxiGYArdef1fItQd47weqB7iwtfr9JHwRrqIXZdcFMvvEcL9xHCmL0SNsOvF0c42lWyM1U5dgig==",
1091
+ "version": "9.39.1",
1092
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz",
1093
+ "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==",
1095
1094
  "dev": true,
1096
1095
  "license": "MIT",
1097
- "peer": true,
1098
1096
  "dependencies": {
1099
1097
  "@eslint-community/eslint-utils": "^4.8.0",
1100
1098
  "@eslint-community/regexpp": "^4.12.1",
1101
- "@eslint/config-array": "^0.21.0",
1102
- "@eslint/config-helpers": "^0.4.0",
1103
- "@eslint/core": "^0.16.0",
1099
+ "@eslint/config-array": "^0.21.1",
1100
+ "@eslint/config-helpers": "^0.4.2",
1101
+ "@eslint/core": "^0.17.0",
1104
1102
  "@eslint/eslintrc": "^3.3.1",
1105
- "@eslint/js": "9.37.0",
1106
- "@eslint/plugin-kit": "^0.4.0",
1103
+ "@eslint/js": "9.39.1",
1104
+ "@eslint/plugin-kit": "^0.4.1",
1107
1105
  "@humanfs/node": "^0.16.6",
1108
1106
  "@humanwhocodes/module-importer": "^1.0.1",
1109
1107
  "@humanwhocodes/retry": "^0.4.2",
1110
1108
  "@types/estree": "^1.0.6",
1111
- "@types/json-schema": "^7.0.15",
1112
1109
  "ajv": "^6.12.4",
1113
1110
  "chalk": "^4.0.0",
1114
1111
  "cross-spawn": "^7.0.6",
@@ -1216,7 +1213,6 @@
1216
1213
  "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
1217
1214
  "dev": true,
1218
1215
  "license": "MIT",
1219
- "peer": true,
1220
1216
  "dependencies": {
1221
1217
  "@rtsao/scc": "^1.1.0",
1222
1218
  "array-includes": "^3.1.9",
@@ -1756,9 +1752,20 @@
1756
1752
  }
1757
1753
  },
1758
1754
  "node_modules/html-entities": {
1759
- "version": "2.3.2",
1760
- "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.2.tgz",
1761
- "integrity": "sha512-c3Ab/url5ksaT0WyleslpBEthOzWhrjQbg75y7XUsfSzi3Dgzt0l8w5e7DylRn15MTlMMD58dTfzddNS2kcAjQ=="
1755
+ "version": "2.6.0",
1756
+ "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.6.0.tgz",
1757
+ "integrity": "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==",
1758
+ "funding": [
1759
+ {
1760
+ "type": "github",
1761
+ "url": "https://github.com/sponsors/mdevils"
1762
+ },
1763
+ {
1764
+ "type": "patreon",
1765
+ "url": "https://patreon.com/mdevils"
1766
+ }
1767
+ ],
1768
+ "license": "MIT"
1762
1769
  },
1763
1770
  "node_modules/ignore": {
1764
1771
  "version": "5.3.2",
@@ -2234,10 +2241,11 @@
2234
2241
  }
2235
2242
  },
2236
2243
  "node_modules/js-yaml": {
2237
- "version": "4.1.0",
2238
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
2239
- "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
2244
+ "version": "4.1.1",
2245
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
2246
+ "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
2240
2247
  "dev": true,
2248
+ "license": "MIT",
2241
2249
  "dependencies": {
2242
2250
  "argparse": "^2.0.1"
2243
2251
  },
@@ -2385,9 +2393,9 @@
2385
2393
  }
2386
2394
  },
2387
2395
  "node_modules/mocha": {
2388
- "version": "11.7.4",
2389
- "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.4.tgz",
2390
- "integrity": "sha512-1jYAaY8x0kAZ0XszLWu14pzsf4KV740Gld4HXkhNTXwcHx4AUEDkPzgEHg9CM5dVcW+zv036tjpsEbLraPJj4w==",
2396
+ "version": "11.7.5",
2397
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.5.tgz",
2398
+ "integrity": "sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig==",
2391
2399
  "dev": true,
2392
2400
  "license": "MIT",
2393
2401
  "dependencies": {
@@ -2685,6 +2693,7 @@
2685
2693
  "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
2686
2694
  "dev": true,
2687
2695
  "license": "MIT",
2696
+ "peer": true,
2688
2697
  "engines": {
2689
2698
  "node": ">=12"
2690
2699
  },
@@ -3403,9 +3412,10 @@
3403
3412
  }
3404
3413
  },
3405
3414
  "node_modules/validator": {
3406
- "version": "13.7.0",
3407
- "resolved": "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz",
3408
- "integrity": "sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==",
3415
+ "version": "13.15.23",
3416
+ "resolved": "https://registry.npmjs.org/validator/-/validator-13.15.23.tgz",
3417
+ "integrity": "sha512-4yoz1kEWqUjzi5zsPbAS/903QXSYp0UOtHsPpp7p9rHAw/W+dkInskAE386Fat3oKRROwO98d9ZB0G4cObgUyw==",
3418
+ "license": "MIT",
3409
3419
  "engines": {
3410
3420
  "node": ">= 0.10"
3411
3421
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-mentions",
3
- "version": "4.8.0",
3
+ "version": "4.8.2",
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.7.4"
36
+ "mocha": "11.7.5"
37
37
  }
38
38
  }
@@ -6,6 +6,7 @@ $(document).ready(function () {
6
6
  let categoryList;
7
7
  const categorySlugMap = new Map();
8
8
  let localUserList = [];
9
+ let helpers;
9
10
 
10
11
  $(window).on('composer:autocomplete:init chat:autocomplete:init', function (ev, data) {
11
12
  loadTopicUsers(data.element);
@@ -18,16 +19,13 @@ $(document).ready(function () {
18
19
  loadCategoryList();
19
20
  }
20
21
 
21
- let slugify;
22
22
  const strategy = {
23
23
  match: /\B@([^\s\n]*)?$/,
24
24
  search: function (term, callback) {
25
- require(['composer', 'helpers', 'slugify'], function (composer, helpers, _slugify) {
26
- slugify = _slugify;
27
- let mentions = [];
25
+ require(['composer', 'helpers'], function (composer, _helpers) {
26
+ helpers = _helpers;
28
27
  if (!term) {
29
- mentions = entriesToMentions(sortEntries(localUserList), helpers);
30
- return callback(mentions);
28
+ return callback(localUserList.filter((user) => user.uid !== app.user.uid));
31
29
  }
32
30
 
33
31
  // Get composer metadata
@@ -56,7 +54,7 @@ $(document).ready(function () {
56
54
  // remove local matches from search results, add category matches
57
55
  users = users.filter(u => !localMatches.find(lu => lu.uid === u.uid));
58
56
  users = sortEntries(localMatches).concat(sortEntries([...users, ...categoryMatches]));
59
- mentions = entriesToMentions(users, helpers);
57
+ // mentions = entriesToMentions(users, helpers);
60
58
 
61
59
  // Add groups that start with the search term
62
60
  const groupMentions = groupList.filter(function (groupName) {
@@ -66,27 +64,20 @@ $(document).ready(function () {
66
64
  });
67
65
 
68
66
  // Add group mentions at the bottom of dropdown
69
- mentions = mentions.concat(groupMentions);
67
+ // mentions = mentions.concat(groupMentions);
70
68
 
71
- callback(mentions);
69
+ callback([...users, ...groupMentions]);
72
70
  });
73
71
  });
74
72
  },
75
73
  index: 1,
74
+ template: entryToMention,
76
75
  replace: function (mention) {
77
- // Strip (fullname) part from mentions
78
- mention = mention.replace(/ \(.+\)$/, '');
79
- mention = $('<div/>').html(mention);
80
- // Strip letter avatar
81
- mention.find('span').remove();
82
-
83
- const text = mention.text().trim();
84
- const categoryHandle = categorySlugMap.get(text.toLowerCase());
85
- if (categoryHandle) {
86
- return `@${categoryHandle}`;
76
+ if (mention.uid) {
77
+ return `@${mention.userslug} `;
78
+ } else if (mention.cid) {
79
+ return `@${utils.isNumber(mention.cid) ? mention.handle : mention.slug} `;
87
80
  }
88
-
89
- return '@' + slugify(text, true) + ' ';
90
81
  },
91
82
  cache: true,
92
83
  };
@@ -107,34 +98,23 @@ $(document).ready(function () {
107
98
  });
108
99
  }
109
100
 
110
- function entriesToMentions(entries, helpers) {
111
- return entries.reduce(function (carry, entry) {
112
- // Don't add current user to suggestions
113
- if (app.user.username && app.user.username === entry.username) {
114
- return carry;
101
+ function entryToMention(entry) {
102
+ // Format suggestions as 'avatar username/name (fullname/slug)'
103
+ switch(true) {
104
+ case entry.hasOwnProperty('uid'): {
105
+ const avatar = helpers.buildAvatar(entry, '24px', true);
106
+ const fullname = entry.fullname ? `(${entry.fullname})` : '';
107
+ return `${avatar} ${entry.username || entry.name} ${helpers.escape(fullname)}`;
115
108
  }
116
109
 
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);
110
+ case entry.hasOwnProperty('cid'): {
111
+ const avatar = helpers.buildCategoryIcon(entry, '24px', 'rounded-circle');
112
+ return `${avatar} ${entry.name}${!utils.isNumber(entry.cid) ? ` (${entry.slug})` : ''}`;
134
113
  }
135
114
 
136
- return carry;
137
- }, []);
115
+ default:
116
+ return entry.name;
117
+ }
138
118
  }
139
119
 
140
120
  function loadTopicUsers(element) {