nodebb-plugin-poll 4.0.2 → 4.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/lib/sockets.js +2 -2
- package/library.js +7 -0
- package/package.json +1 -1
- package/plugin.json +1 -2
package/lib/sockets.js
CHANGED
|
@@ -23,8 +23,8 @@ Sockets.get = async function (socket, data) {
|
|
|
23
23
|
if (!Array.isArray(data.pollIds) || !data.pollIds.length) {
|
|
24
24
|
throw new Error('Invalid request, pollId is required');
|
|
25
25
|
}
|
|
26
|
-
if (
|
|
27
|
-
|
|
26
|
+
if (!socket.uid && !allowAnon) {
|
|
27
|
+
return [];
|
|
28
28
|
}
|
|
29
29
|
return await Promise.all(data.pollIds.map(async (pollId) => {
|
|
30
30
|
const pollData = await Poll.get(pollId, socket.uid, !!socket.uid);
|
package/library.js
CHANGED
|
@@ -90,6 +90,13 @@ Plugin.defineWidgets = async function (widgets) {
|
|
|
90
90
|
Plugin.renderPollWidget = async function (widget) {
|
|
91
91
|
const { pollId } = widget.data;
|
|
92
92
|
const Poll = require('./lib/poll');
|
|
93
|
+
|
|
94
|
+
const settings = await Config.getSettings();
|
|
95
|
+
const allowAnon = parseInt(settings.allowGuestsToViewResults, 10) === 1;
|
|
96
|
+
|
|
97
|
+
if (!widget.uid && !allowAnon) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
93
100
|
const pollData = await Poll.get(pollId, widget.uid, widget.req.loggedIn);
|
|
94
101
|
if (!pollData) {
|
|
95
102
|
return null;
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -34,8 +34,7 @@
|
|
|
34
34
|
"public/js/poll/view.js"
|
|
35
35
|
],
|
|
36
36
|
"modules": {
|
|
37
|
-
"../admin/plugins/poll.js": "public/js/admin.js"
|
|
38
|
-
"poll/serializer.js": "public/js/poll/serializer.js"
|
|
37
|
+
"../admin/plugins/poll.js": "public/js/admin.js"
|
|
39
38
|
},
|
|
40
39
|
"templates": "templates",
|
|
41
40
|
"languages": "languages",
|