nodebb-plugin-poll 3.1.8 → 3.2.1

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/library.js CHANGED
@@ -8,10 +8,9 @@ const Scheduler = require('./lib/scheduler');
8
8
 
9
9
  const Plugin = module.exports;
10
10
 
11
-
12
11
  Plugin.hooks = Hooks;
13
12
 
14
- Plugin.load = function (params, callback) {
13
+ Plugin.load = async function (params) {
15
14
  const routeHelpers = require.main.require('./src/routes/helpers');
16
15
  const { router } = params;
17
16
 
@@ -27,27 +26,25 @@ Plugin.load = function (params, callback) {
27
26
  NodeBB.app = params.app;
28
27
  Scheduler.start();
29
28
 
30
- Config.init(callback);
29
+ await Config.init();
31
30
  };
32
31
 
33
- Plugin.addAdminNavigation = function (adminHeader, callback) {
32
+ Plugin.addAdminNavigation = function (adminHeader) {
34
33
  adminHeader.plugins.push({
35
34
  route: `/plugins/${Config.plugin.id}`,
36
35
  icon: Config.plugin.icon,
37
36
  name: Config.plugin.name,
38
37
  });
39
-
40
- callback(null, adminHeader);
38
+ return adminHeader;
41
39
  };
42
40
 
43
- Plugin.registerFormatting = function (payload, callback) {
41
+ Plugin.registerFormatting = function (payload) {
44
42
  payload.options.push({
45
43
  name: 'poll',
46
44
  className: `fa ${Config.plugin.icon}`,
47
45
  title: '[[poll:creator_title]]',
48
46
  });
49
-
50
- callback(null, payload);
47
+ return payload;
51
48
  };
52
49
 
53
50
  Plugin.addPrivilege = function (hookData) {
@@ -56,7 +53,7 @@ Plugin.addPrivilege = function (hookData) {
56
53
  );
57
54
  };
58
55
 
59
- Plugin.copyPrivilegesFrom = function (data, callback) {
56
+ Plugin.copyPrivilegesFrom = function (data) {
60
57
  if (data.privileges.indexOf('poll:create') === -1) {
61
58
  data.privileges.push('poll:create');
62
59
  }
@@ -64,5 +61,5 @@ Plugin.copyPrivilegesFrom = function (data, callback) {
64
61
  if (data.privileges.indexOf('groups:poll:create') === -1) {
65
62
  data.privileges.push('groups:poll:create');
66
63
  }
67
- callback(null, data);
64
+ return data;
68
65
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-poll",
3
- "version": "3.1.8",
3
+ "version": "3.2.1",
4
4
  "description": "NodeBB Poll Plugin",
5
5
  "main": "library.js",
6
6
  "scripts": {
package/plugin.json CHANGED
@@ -20,10 +20,6 @@
20
20
  { "hook": "action:topic.delete", "method": "hooks.action.topicDelete" },
21
21
  { "hook": "action:topic.restore", "method": "hooks.action.topicRestore" }
22
22
  ],
23
- "staticDirs": {
24
- "public": "public",
25
- "vendor": "vendor"
26
- },
27
23
  "scss": [
28
24
  "public/scss/style.scss"
29
25
  ],
@@ -37,9 +33,6 @@
37
33
  "../admin/plugins/poll.js": "public/js/admin.js",
38
34
  "poll/serializer.js": "public/js/poll/serializer.js"
39
35
  },
40
- "css": [
41
- "vendor/flatpickr.min.css"
42
- ],
43
36
  "templates": "templates",
44
37
  "languages": "languages",
45
38
  "upgrades": [
@@ -80,7 +80,7 @@
80
80
 
81
81
  Poll.sockets.getConfig(null, function (err, config) {
82
82
  if (err) {
83
- console.error(err);
83
+ return alerts.error(err);
84
84
  }
85
85
 
86
86
  var poll = {};
@@ -85,7 +85,7 @@ module.exports = function (utils) {
85
85
 
86
86
  rawOptions.forEach(function (option) {
87
87
  if (option.length) {
88
- option = option.split('-').slice(1).join('-').trim()
88
+ option = option.split('-').slice(1).join('-').trim();
89
89
 
90
90
  if (option.length) {
91
91
  pollOptions.push(option);
@@ -2,28 +2,3 @@
2
2
  .composer.reply .poll, .composer.reply .ql-poll {
3
3
  display: none;
4
4
  }
5
-
6
- .poll-view {
7
- h2, h3 {
8
- margin-top: 0;
9
- }
10
-
11
- .card-title {
12
- display: inline-block;
13
- }
14
-
15
- .btn-group {
16
- display: block;
17
- a {
18
- color: inherit;
19
- }
20
- }
21
- }
22
-
23
- .poll-result-details:hover {
24
- text-decoration: none;
25
- }
26
-
27
- .poll-creator {
28
- z-index: 11000 !important;
29
- }
@@ -1,12 +1,11 @@
1
1
  <div class="poll-view mb-3" data-poll-id="{poll.info.pollId}">
2
2
  <div class="card">
3
- <div class="card-header">
3
+ <div class="card-header d-flex justify-content-between align-items-center">
4
4
  <h5 class="card-title mb-0">{poll.settings.title}</h5>
5
- <div class="btn-group float-end hidden">
6
- <a href="#" class="poll-button-edit">
7
- <span class="fa fa-pencil"></span>
8
- </a>
9
- </div>
5
+
6
+ <a href="#" class="btn btn-sm btn-light border poll-button-edit hidden">
7
+ <span class="fa fa-pencil"></span>
8
+ </a>
10
9
  </div>
11
10
  <div class="card-body">
12
11
  <div class="poll-view-messages hidden"></div>