nodebb-plugin-poll 4.0.10 → 4.0.11

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/lib/sockets.js CHANGED
@@ -15,7 +15,7 @@ const Sockets = exports;
15
15
 
16
16
  Sockets.get = async function (socket, data) {
17
17
  const settings = await Config.getSettings();
18
- const allowAnon = parseInt(settings.allowGuestsToViewResults, 10) === 1;
18
+ const allowAnon = settings.allowGuestsToViewResults === 'on';
19
19
 
20
20
  if (!data) {
21
21
  throw new Error('Invalid request, request data is not defined');
package/library.js CHANGED
@@ -92,7 +92,7 @@ Plugin.renderPollWidget = async function (widget) {
92
92
  const Poll = require('./lib/poll');
93
93
 
94
94
  const settings = await Config.getSettings();
95
- const allowAnon = parseInt(settings.allowGuestsToViewResults, 10) === 1;
95
+ const allowAnon = settings.allowGuestsToViewResults === 'on';
96
96
 
97
97
  if (!widget.uid && !allowAnon) {
98
98
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-poll",
3
- "version": "4.0.10",
3
+ "version": "4.0.11",
4
4
  "description": "NodeBB Poll Plugin",
5
5
  "main": "library.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "cron": "^1.8.2"
27
27
  },
28
28
  "nbbpm": {
29
- "compatibility": "^4.12.0"
29
+ "compatibility": "^4.14.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "eslint": "10.0.3",
@@ -41,21 +41,22 @@
41
41
  }
42
42
 
43
43
  async function openManageModal(payload) {
44
- const bootbox = await app.require('bootbox');
44
+ const [modals, Benchpress] = await app.require(['modals', 'benchpressjs']);
45
45
  const { postData, modal, uuid } = payload;
46
- const html = await app.parseAndTranslate('poll/manage', { post: postData });
46
+ const html = await Benchpress.render('poll/manage', { post: postData });
47
47
 
48
48
  if (modal) {
49
- modal.find('.bootbox-body').html(html[0].outerHTML);
49
+ // modal.find('.bootbox-body').html(html[0].outerHTML);
50
+ modal.find('.bootbox-body').html(html);
50
51
  handleSort({ modal, polls: postData.polls });
51
52
  } else {
52
- const modal = bootbox.dialog({
53
+ const modal = await modals.dialog({
53
54
  title: '[[poll:manage-polls]]',
54
55
  message: html,
55
56
  className: 'poll-manage',
56
57
  buttons: {
57
58
  add: {
58
- label: '<i class="fa fa-plus"></i> [[poll:add-poll]]',
59
+ label: '[[poll:add-poll]]',
59
60
  className: 'btn-success',
60
61
  callback: () => {
61
62
  Creator.show('[[poll:creator_title]]', {
@@ -88,11 +89,11 @@
88
89
  }
89
90
 
90
91
  async function handleDelete(payload) {
91
- const bootbox = await app.require('bootbox');
92
+ const modals = await app.require('modals');
92
93
  const { uuid, modal, postData } = payload;
93
94
  modal.on('click', 'button[data-action="remove"]', function () {
94
95
  const clickedPollId = $(this).attr('data-poll-id');
95
- bootbox.confirm('[[poll:confirm-remove]]', (ok) => {
96
+ modals.confirm('[[poll:confirm-remove]]', (ok) => {
96
97
  if (!ok) {
97
98
  return;
98
99
  }
@@ -155,9 +156,9 @@
155
156
 
156
157
  Creator.show = function (modalTitle, poll, config) {
157
158
  return new Promise((resolve) => {
158
- require(['bootbox'], function (bootbox) {
159
- app.parseAndTranslate('poll/creator', { poll, config }, function (html) {
160
- const modal = bootbox.dialog({
159
+ app.require(['benchpressjs', 'modals']).then(([Benchpress, modals]) => {
160
+ Benchpress.render('poll/creator', { poll, config }).then(async function (html) {
161
+ const modal = await modals.dialog({
161
162
  title: modalTitle,
162
163
  message: html,
163
164
  className: 'poll-creator',