nodebb-plugin-mentions 3.0.3 → 3.0.4

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": "3.0.3",
3
+ "version": "3.0.4",
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
  "scripts": {
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "mocha": "9.1.3",
35
- "eslint": "8.2.0",
36
- "eslint-config-nodebb": "0.0.3",
35
+ "eslint": "8.4.0",
36
+ "eslint-config-nodebb": "0.1.1",
37
37
  "eslint-plugin-import": "2.25.3"
38
38
  }
39
39
  }
package/static/admin.js CHANGED
@@ -1,36 +1,37 @@
1
- 'use strict';
2
- /* globals $, app, socket */
3
-
4
- define('admin/plugins/mentions', ['settings'], function (Settings) {
5
-
6
- var ACP = {};
7
-
8
- ACP.init = function () {
9
- Settings.load('mentions', $('.mentions-settings'));
10
-
11
- $(window).on('action:admin.settingsLoaded', applyDefaults);
12
-
13
- $('#save').on('click', function () {
14
- Settings.save('mentions', $('.mentions-settings'), function () {
15
- app.alert({
16
- type: 'success',
17
- alert_id: 'mentions-saved',
18
- title: 'Settings Saved',
19
- message: 'Please reload your NodeBB to apply these settings',
20
- clickfn: function () {
21
- socket.emit('admin.reload');
22
- }
23
- });
24
- });
25
- });
26
- };
27
-
28
- function applyDefaults() {
29
- if (!ajaxify.data.settings || !ajaxify.data.settings.hasOwnProperty('autofillGroups')) {
30
- $('input#autofillGroups').parents('.mdl-switch').toggleClass('is-checked', false);
31
- $('input#autofillGroups').prop('checked', false);
32
- }
33
- }
34
-
35
- return ACP;
1
+ 'use strict';
2
+
3
+ /* globals $, app, socket, define */
4
+
5
+ define('admin/plugins/mentions', ['settings', 'alerts'], function (Settings, alerts) {
6
+
7
+ var ACP = {};
8
+
9
+ ACP.init = function () {
10
+ Settings.load('mentions', $('.mentions-settings'));
11
+
12
+ $(window).on('action:admin.settingsLoaded', applyDefaults);
13
+
14
+ $('#save').on('click', function () {
15
+ Settings.save('mentions', $('.mentions-settings'), function () {
16
+ alerts.alert({
17
+ type: 'success',
18
+ alert_id: 'mentions-saved',
19
+ title: 'Settings Saved',
20
+ message: 'Please reload your NodeBB to apply these settings',
21
+ clickfn: function () {
22
+ socket.emit('admin.reload');
23
+ }
24
+ });
25
+ });
26
+ });
27
+ };
28
+
29
+ function applyDefaults() {
30
+ if (!ajaxify.data.settings || !ajaxify.data.settings.hasOwnProperty('autofillGroups')) {
31
+ $('input#autofillGroups').parents('.mdl-switch').toggleClass('is-checked', false);
32
+ $('input#autofillGroups').prop('checked', false);
33
+ }
34
+ }
35
+
36
+ return ACP;
36
37
  });
@@ -118,7 +118,10 @@ $(document).ready(function() {
118
118
  function loadGroupList() {
119
119
  socket.emit('plugins.mentions.listGroups', function(err, groupNames) {
120
120
  if (err) {
121
- return app.alertError(err.message);
121
+ require(['alerts'], function (alerts) {
122
+ alerts.error(err);
123
+ })
124
+ return;
122
125
  }
123
126
  groupList = groupNames;
124
127
  });