nodebb-plugin-poll 3.0.0 → 3.0.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.
@@ -43,5 +43,6 @@
43
43
  "vote_is_final": "Changing your vote is not allowed for this poll so your vote is final",
44
44
 
45
45
  "vote_count": "users voted for this option",
46
- "votes": "votes"
46
+ "votes": "votes",
47
+ "admin.create-poll": "Create Poll"
47
48
  }
package/library.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const NodeBB = require('./lib/nodebb');
3
+ const NodeBB = require('./lib/nodebb');
4
4
  const Config = require('./lib/config');
5
5
  const Sockets = require('./lib/sockets');
6
6
  const Hooks = require('./lib/hooks');
@@ -46,19 +46,10 @@ const Scheduler = require('./lib/scheduler');
46
46
  callback(null, payload);
47
47
  };
48
48
 
49
- Plugin.addUserPrivilege = function (privileges, callback) {
50
- privileges.push('poll:create');
51
- callback(null, privileges);
52
- };
53
-
54
- Plugin.addPrivilegeLabels = function (labels, callback) {
55
- labels.push({ name: 'Create Poll' });
56
- callback(null, labels);
57
- };
58
-
59
- Plugin.addGroupPrivilege = function (privileges, callback) {
60
- privileges.push('groups:poll:create');
61
- callback(null, privileges);
49
+ Plugin.addPrivilege = function (hookData) {
50
+ hookData.privileges.set(
51
+ 'poll:create', { label: '[[poll:admin.create-poll]]' },
52
+ );
62
53
  };
63
54
 
64
55
  Plugin.copyPrivilegesFrom = function (data, callback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-poll",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "NodeBB Poll Plugin",
5
5
  "main": "library.js",
6
6
  "scripts": {
package/plugin.json CHANGED
@@ -8,13 +8,8 @@
8
8
  { "hook": "static:app.load", "method": "load" },
9
9
  { "hook": "filter:admin.header.build", "method": "addAdminNavigation" },
10
10
  { "hook": "filter:composer.formatting", "method": "registerFormatting" },
11
-
12
- { "hook": "filter:privileges.list", "method": "addUserPrivilege" },
13
- { "hook": "filter:privileges.groups.list", "method": "addGroupPrivilege" },
14
- { "hook": "filter:privileges.list_human", "method": "addPrivilegeLabels" },
15
- { "hook": "filter:privileges.groups.list_human", "method": "addPrivilegeLabels" },
11
+ { "hook": "static:privileges.categories.init", "method": "addPrivilege" },
16
12
  { "hook": "filter:categories.copyPrivilegesFrom", "method": "copyPrivilegesFrom" },
17
-
18
13
  { "hook": "filter:topic.post", "method": "hooks.filter.topicPost" },
19
14
  { "hook": "filter:parse.raw", "method": "hooks.filter.parseRaw", "priority": 1 },
20
15
  { "hook": "filter:post.create", "method": "hooks.filter.postCreate" },