nodebb-plugin-poll 3.2.3 → 3.2.5
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/.eslintrc +1 -114
- package/lib/sockets.js +3 -3
- package/library.js +33 -1
- package/package.json +2 -2
- package/plugin.json +4 -1
- package/public/js/.eslintrc +2 -81
- package/public/js/poll/main.js +19 -6
- package/public/js/poll/view.js +41 -36
- package/templates/admin/partials/widgets/poll.tpl +5 -0
- package/templates/poll/view/messages.tpl +1 -1
- package/templates/poll/widget.tpl +1 -0
package/.eslintrc
CHANGED
|
@@ -1,116 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "
|
|
3
|
-
"ignorePatterns": ["**/vendor/*.js"],
|
|
4
|
-
"parserOptions": {
|
|
5
|
-
"sourceType": "script"
|
|
6
|
-
},
|
|
7
|
-
|
|
8
|
-
"rules": {
|
|
9
|
-
// === Configure rules for our style ===
|
|
10
|
-
// imports must be resolvable
|
|
11
|
-
"import/no-unresolved": "error",
|
|
12
|
-
// use single quotes,
|
|
13
|
-
// unless a different style allows avoiding escapes
|
|
14
|
-
"quotes": ["error", "single", {
|
|
15
|
-
"avoidEscape": true,
|
|
16
|
-
"allowTemplateLiterals": true
|
|
17
|
-
}],
|
|
18
|
-
// allow else-if return
|
|
19
|
-
"no-else-return": [ "error", { "allowElseIf": true } ],
|
|
20
|
-
// expressions split over multiple lines
|
|
21
|
-
// should break after the operator
|
|
22
|
-
"operator-linebreak": [ "error", "after" ],
|
|
23
|
-
// require arrow parens only when needed
|
|
24
|
-
// and whenever the body is a block
|
|
25
|
-
"arrow-parens": ["error", "as-needed", { "requireForBlockBody": true }],
|
|
26
|
-
// what variables are errors in callbacks
|
|
27
|
-
"handle-callback-err": [ "error","^(e$|(e|(.*(_e|E)))rr)" ],
|
|
28
|
-
// allow dangling commas in functions
|
|
29
|
-
// require them everywhere else
|
|
30
|
-
"comma-dangle": ["error", {
|
|
31
|
-
"arrays": "always-multiline",
|
|
32
|
-
"objects": "always-multiline",
|
|
33
|
-
"imports": "always-multiline",
|
|
34
|
-
"exports": "always-multiline",
|
|
35
|
-
"functions": "only-multiline"
|
|
36
|
-
}],
|
|
37
|
-
// we actually encourage `return await`
|
|
38
|
-
"no-return-await": "off",
|
|
39
|
-
// allow `while (true)`
|
|
40
|
-
"no-constant-condition": ["error", { "checkLoops": false }],
|
|
41
|
-
// allow ignoring an error with `catch`
|
|
42
|
-
"no-empty": ["error", { "allowEmptyCatch": true }],
|
|
43
|
-
// allow `3 + 5 - 1`, but not `3 * 5 - 1`
|
|
44
|
-
"no-mixed-operators": ["error", { "allowSamePrecedence": true }],
|
|
45
|
-
// require `'use strict';`
|
|
46
|
-
"strict": ["error", "global"],
|
|
47
|
-
// we actually use tabs for indentation
|
|
48
|
-
"indent": ["error", "tab", { "SwitchCase": 1 }],
|
|
49
|
-
"no-tabs": "off",
|
|
50
|
-
// we want `== null` to also handle undefined
|
|
51
|
-
"no-eq-null": "off",
|
|
52
|
-
// allow `for (..; i++)`
|
|
53
|
-
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
|
|
54
|
-
// allow using functions defined later
|
|
55
|
-
"no-use-before-define": ["error", "nofunc"],
|
|
56
|
-
// require consistent newlines before and after braces
|
|
57
|
-
// if contents are multiline
|
|
58
|
-
"object-curly-newline": ["error", { "consistent": true, "multiline": true }],
|
|
59
|
-
// require consistent linebreaks inline function parenthesis (arguments or params)
|
|
60
|
-
"function-paren-newline": ["error", "consistent"],
|
|
61
|
-
// only require const if all parts of destructuring can be const
|
|
62
|
-
"prefer-const": ["error", { "destructuring": "all" }],
|
|
63
|
-
// don't require destructuring for arrays or assignment
|
|
64
|
-
"prefer-destructuring": ["error", {
|
|
65
|
-
"VariableDeclarator": { "array": false, "object": true },
|
|
66
|
-
"AssignmentExpression": { "array": false, "object": false }
|
|
67
|
-
}],
|
|
68
|
-
// identical to airbnb rule, except for allowing for..of, because we want to use it
|
|
69
|
-
"no-restricted-syntax": [
|
|
70
|
-
"error",
|
|
71
|
-
{
|
|
72
|
-
"selector": "ForInStatement",
|
|
73
|
-
"message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"selector": "LabeledStatement",
|
|
77
|
-
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"selector": "WithStatement",
|
|
81
|
-
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
// allow lines of up to 120 characters
|
|
85
|
-
"max-len": ["error", { "code": 120, "tabWidth": 2, "ignoreUrls": true, "ignoreStrings": true, "ignoreTemplateLiterals": true, "ignoreRegExpLiterals": true }],
|
|
86
|
-
|
|
87
|
-
// === Disable rules ===
|
|
88
|
-
// more liberal naming
|
|
89
|
-
"camelcase": "off",
|
|
90
|
-
"no-underscore-dangle": "off",
|
|
91
|
-
// don't require anonymous function names
|
|
92
|
-
"func-names": "off",
|
|
93
|
-
// allow console
|
|
94
|
-
"no-console": "off",
|
|
95
|
-
// allow new for side effects
|
|
96
|
-
// allow new with non-capitalized
|
|
97
|
-
"no-new": "off",
|
|
98
|
-
"new-cap": "off",
|
|
99
|
-
// allow shadowing variables (usually callbacks)
|
|
100
|
-
"no-shadow": "off",
|
|
101
|
-
// allow multiple empty lines in a row
|
|
102
|
-
"no-multiple-empty-lines": "off",
|
|
103
|
-
// allow not using object shorthand
|
|
104
|
-
"object-shorthand": "off",
|
|
105
|
-
|
|
106
|
-
// TODO
|
|
107
|
-
"consistent-return": "off",
|
|
108
|
-
"no-restricted-globals": "off",
|
|
109
|
-
"no-prototype-builtins": "off",
|
|
110
|
-
"import/no-extraneous-dependencies": "off",
|
|
111
|
-
"import/no-dynamic-require": "off",
|
|
112
|
-
"global-require": "off",
|
|
113
|
-
"no-param-reassign": "off",
|
|
114
|
-
"default-case": "off"
|
|
115
|
-
}
|
|
2
|
+
"extends": "nodebb"
|
|
116
3
|
}
|
package/lib/sockets.js
CHANGED
|
@@ -75,7 +75,7 @@ Sockets.vote = async function (socket, data) {
|
|
|
75
75
|
await Vote.add(data);
|
|
76
76
|
|
|
77
77
|
const pollData = await Poll.get(data.pollId, socket.uid, false);
|
|
78
|
-
NodeBB.SocketIndex.server.sockets.emit('event:poll.voteChange', pollData);
|
|
78
|
+
NodeBB.SocketIndex.server.sockets.emit('event:poll.voteChange', { pollData, uid: socket.uid });
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
Sockets.updateVote = async function (socket, data) {
|
|
@@ -111,7 +111,7 @@ Sockets.updateVote = async function (socket, data) {
|
|
|
111
111
|
|
|
112
112
|
await Vote.update(data);
|
|
113
113
|
const pollData = await Poll.get(data.pollId, socket.uid, false);
|
|
114
|
-
NodeBB.SocketIndex.server.sockets.emit('event:poll.voteChange', pollData);
|
|
114
|
+
NodeBB.SocketIndex.server.sockets.emit('event:poll.voteChange', { pollData, uid: socket.uid });
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
Sockets.removeVote = async function (socket, data) {
|
|
@@ -130,7 +130,7 @@ Sockets.removeVote = async function (socket, data) {
|
|
|
130
130
|
|
|
131
131
|
await Vote.remove(data);
|
|
132
132
|
const pollData = await Poll.get(data.pollId, socket.uid, false);
|
|
133
|
-
NodeBB.SocketIndex.server.sockets.emit('event:poll.voteChange', pollData);
|
|
133
|
+
NodeBB.SocketIndex.server.sockets.emit('event:poll.voteChange', { pollData, uid: socket.uid });
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
Sockets.getOptionDetails = async function (socket, data) {
|
package/library.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const nconf = require.main.require('nconf');
|
|
4
|
+
|
|
3
5
|
const NodeBB = require('./lib/nodebb');
|
|
4
6
|
const Config = require('./lib/config');
|
|
5
7
|
const Sockets = require('./lib/sockets');
|
|
@@ -24,7 +26,10 @@ Plugin.load = async function (params) {
|
|
|
24
26
|
NodeBB.AdminSockets[Config.plugin.id] = Config.adminSockets;
|
|
25
27
|
|
|
26
28
|
NodeBB.app = params.app;
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
if (nconf.get('runJobs')) {
|
|
31
|
+
Scheduler.start();
|
|
32
|
+
}
|
|
28
33
|
|
|
29
34
|
await Config.init();
|
|
30
35
|
};
|
|
@@ -63,3 +68,30 @@ Plugin.copyPrivilegesFrom = function (data) {
|
|
|
63
68
|
}
|
|
64
69
|
return data;
|
|
65
70
|
};
|
|
71
|
+
|
|
72
|
+
Plugin.defineWidgets = async function (widgets) {
|
|
73
|
+
const widget = {
|
|
74
|
+
widget: 'poll',
|
|
75
|
+
name: 'Poll',
|
|
76
|
+
description: 'Display a poll',
|
|
77
|
+
content: await NodeBB.app.renderAsync('admin/partials/widgets/poll', {}),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
widgets.push(widget);
|
|
81
|
+
return widgets;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
Plugin.renderPollWidget = async function (widget) {
|
|
85
|
+
const { tid } = widget.data;
|
|
86
|
+
const Poll = require('./lib/poll');
|
|
87
|
+
const pollId = await Poll.getPollIdByTid(tid);
|
|
88
|
+
if (!pollId) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
const pollData = await Poll.get(pollId, widget.uid, widget.req.loggedIn);
|
|
92
|
+
if (!pollData) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
widget.html = await NodeBB.app.renderAsync('poll/widget.tpl', { pollId });
|
|
96
|
+
return widget;
|
|
97
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-poll",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.5",
|
|
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": "^
|
|
29
|
+
"compatibility": "^4.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"eslint": "8.57.0",
|
package/plugin.json
CHANGED
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
{ "hook": "action:post.delete", "method": "hooks.action.postDelete" },
|
|
19
19
|
{ "hook": "action:post.restore", "method": "hooks.action.postRestore" },
|
|
20
20
|
{ "hook": "action:topic.delete", "method": "hooks.action.topicDelete" },
|
|
21
|
-
{ "hook": "action:topic.restore", "method": "hooks.action.topicRestore" }
|
|
21
|
+
{ "hook": "action:topic.restore", "method": "hooks.action.topicRestore" },
|
|
22
|
+
|
|
23
|
+
{ "hook": "filter:widgets.getWidgets", "method": "defineWidgets" },
|
|
24
|
+
{ "hook": "filter:widget.render:poll", "method": "renderPollWidget" }
|
|
22
25
|
],
|
|
23
26
|
"scss": [
|
|
24
27
|
"public/scss/style.scss"
|
package/public/js/.eslintrc
CHANGED
|
@@ -1,82 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
"io": true,
|
|
5
|
-
"socket": true,
|
|
6
|
-
"ajaxify": true,
|
|
7
|
-
"config": true,
|
|
8
|
-
"utils": true,
|
|
9
|
-
"overrides": true,
|
|
10
|
-
"componentHandler": true,
|
|
11
|
-
"bootbox": true,
|
|
12
|
-
"Visibility": true,
|
|
13
|
-
"Tinycon": true,
|
|
14
|
-
"Promise": true
|
|
15
|
-
},
|
|
16
|
-
"env": {
|
|
17
|
-
"jquery": true,
|
|
18
|
-
"amd": true,
|
|
19
|
-
"browser": true,
|
|
20
|
-
"es6": true
|
|
21
|
-
},
|
|
22
|
-
"rules": {
|
|
23
|
-
"comma-dangle": ["error", {
|
|
24
|
-
"arrays": "always-multiline",
|
|
25
|
-
"objects": "always-multiline",
|
|
26
|
-
"imports": "always-multiline",
|
|
27
|
-
"exports": "always-multiline",
|
|
28
|
-
"functions": "never"
|
|
29
|
-
}],
|
|
30
|
-
"block-scoped-var": "off",
|
|
31
|
-
"no-dupe-class-members": "off",
|
|
32
|
-
"prefer-object-spread": "off",
|
|
33
|
-
"prefer-reflect": "off",
|
|
34
|
-
|
|
35
|
-
// ES6
|
|
36
|
-
"prefer-rest-params": "off",
|
|
37
|
-
"prefer-spread": "off",
|
|
38
|
-
"prefer-arrow-callback": "off",
|
|
39
|
-
"prefer-template": "off",
|
|
40
|
-
"no-var": "off",
|
|
41
|
-
"object-shorthand": "off",
|
|
42
|
-
"vars-on-top": "off",
|
|
43
|
-
"prefer-destructuring": "off",
|
|
44
|
-
// identical to airbnb rule
|
|
45
|
-
// except for allowing for..in, because for..of is unavailable on some clients
|
|
46
|
-
"no-restricted-syntax": [
|
|
47
|
-
"error",
|
|
48
|
-
{
|
|
49
|
-
"selector": "ForOfStatement",
|
|
50
|
-
"message": "iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations."
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"selector": "LabeledStatement",
|
|
54
|
-
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"selector": "WithStatement",
|
|
58
|
-
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
"parserOptions": {
|
|
63
|
-
"ecmaVersion": 2018,
|
|
64
|
-
"ecmaFeatures": {
|
|
65
|
-
"classes": false,
|
|
66
|
-
"defaultParams": false,
|
|
67
|
-
"blockBindings": false,
|
|
68
|
-
"forOf": false,
|
|
69
|
-
"generators": false,
|
|
70
|
-
"globalReturn": false,
|
|
71
|
-
"jsx": false,
|
|
72
|
-
"modules": false,
|
|
73
|
-
"objectLiteralComputedProperties": false,
|
|
74
|
-
"objectLiteralDuplicateProperties": false,
|
|
75
|
-
"objectLiteralShorthandMethods": false,
|
|
76
|
-
"objectLiteralShorthandProperties": false,
|
|
77
|
-
"impliedStrict": false,
|
|
78
|
-
"restParams": false,
|
|
79
|
-
"superInFunctions": false
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
2
|
+
"extends": "nodebb/public"
|
|
3
|
+
}
|
package/public/js/poll/main.js
CHANGED
|
@@ -16,36 +16,49 @@ window.Poll = {};
|
|
|
16
16
|
|
|
17
17
|
$(window).on('action:topic.loading', function () {
|
|
18
18
|
if (ajaxify.data.posts.length > 0 && ajaxify.data.posts[0].hasOwnProperty('pollId')) {
|
|
19
|
-
|
|
19
|
+
getPollByPost(ajaxify.data.posts[0]);
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
$(window).on('action:posts.loaded', function (ev, data) {
|
|
24
24
|
data.posts.forEach((post) => {
|
|
25
25
|
if (post.hasOwnProperty('pollId')) {
|
|
26
|
-
|
|
26
|
+
getPollByPost(post);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
$(window).on('action:posts.edited', function (ev, data) {
|
|
32
32
|
if (data.post.hasOwnProperty('pollId')) {
|
|
33
|
-
|
|
33
|
+
getPollByPost(data.post);
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
$(window).on('action:ajaxify.end', function () {
|
|
38
|
+
$('[data-widget-poll-id]').each(function () {
|
|
39
|
+
getPoll($(this).attr('data-widget-poll-id'), $(this));
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
37
43
|
socket.on('event:poll.voteChange', function (data) {
|
|
38
|
-
Poll.view.update(data);
|
|
44
|
+
Poll.view.update(data.pollData, data.uid);
|
|
39
45
|
});
|
|
40
46
|
|
|
41
|
-
function
|
|
42
|
-
|
|
47
|
+
function getPollByPost(post) {
|
|
48
|
+
const postEl = $('[component="post"][data-pid="' + post.pid + '"]');
|
|
49
|
+
if (postEl.length && post.pollId) {
|
|
50
|
+
getPoll(post.pollId, postEl.find('[component="post/content"]'));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
43
53
|
|
|
54
|
+
function getPoll(pollId, container) {
|
|
55
|
+
pollId = parseInt(pollId, 10);
|
|
44
56
|
if (!isNaN(pollId)) {
|
|
45
57
|
socket.emit('plugins.poll.get', { pollId }, function (err, pollData) {
|
|
46
58
|
if (err) {
|
|
47
59
|
return Poll.alertError(err.message);
|
|
48
60
|
}
|
|
61
|
+
pollData.container = container;
|
|
49
62
|
Poll.view.load(pollData);
|
|
50
63
|
});
|
|
51
64
|
}
|
package/public/js/poll/view.js
CHANGED
|
@@ -176,44 +176,41 @@
|
|
|
176
176
|
|
|
177
177
|
View.prototype.load = function () {
|
|
178
178
|
var self = this;
|
|
179
|
+
if (!self.pollData.container.length) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
179
182
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
votingPanelButton: panel.find('.poll-button-voting'),
|
|
197
|
-
resultsPanelButton: panel.find('.poll-button-results'),
|
|
198
|
-
editButton: panel.find('.poll-button-edit'),
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
self.hideMessage();
|
|
183
|
+
app.parseAndTranslate('poll/view', { poll: self.pollData }, function (panel) {
|
|
184
|
+
self.pollData.container.prepend(panel);
|
|
185
|
+
self.dom = {
|
|
186
|
+
panel: panel,
|
|
187
|
+
votingForm: panel.find('.poll-voting-form'),
|
|
188
|
+
messages: panel.find('.poll-view-messages'),
|
|
189
|
+
votingPanel: panel.find('.poll-view-voting'),
|
|
190
|
+
resultsPanel: panel.find('.poll-view-results'),
|
|
191
|
+
voteButton: panel.find('.poll-button-vote'),
|
|
192
|
+
voteAnonButton: panel.find('.poll-button-vote-anon'),
|
|
193
|
+
updateVoteButton: panel.find('.poll-button-update-vote'),
|
|
194
|
+
removeVoteButton: panel.find('.poll-button-remove-vote'),
|
|
195
|
+
votingPanelButton: panel.find('.poll-button-voting'),
|
|
196
|
+
resultsPanelButton: panel.find('.poll-button-results'),
|
|
197
|
+
editButton: panel.find('.poll-button-edit'),
|
|
198
|
+
};
|
|
202
199
|
|
|
203
|
-
|
|
204
|
-
self.hasVotedAndVotingUpdateDisallowed();
|
|
200
|
+
self.hideMessage();
|
|
205
201
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
} else {
|
|
209
|
-
self.showVotingPanel();
|
|
210
|
-
}
|
|
202
|
+
self.pollEndedOrDeleted();
|
|
203
|
+
self.hasVotedAndVotingUpdateDisallowed();
|
|
211
204
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
205
|
+
if (!app.user.uid || self.pollData.hasVoted) {
|
|
206
|
+
self.showResultsPanel();
|
|
207
|
+
} else {
|
|
208
|
+
self.showVotingPanel();
|
|
216
209
|
}
|
|
210
|
+
|
|
211
|
+
Actions.forEach(function (action) {
|
|
212
|
+
action.register(self);
|
|
213
|
+
});
|
|
217
214
|
});
|
|
218
215
|
};
|
|
219
216
|
|
|
@@ -241,8 +238,16 @@
|
|
|
241
238
|
}
|
|
242
239
|
};
|
|
243
240
|
|
|
244
|
-
View.prototype.update = function (pollData) {
|
|
241
|
+
View.prototype.update = function (pollData, uid) {
|
|
242
|
+
const isSelf = String(uid) === String(app.user.uid);
|
|
243
|
+
const hasVoted = this.pollData.hasVoted;
|
|
244
|
+
const vote = this.pollData.vote;
|
|
245
245
|
this.pollData = pollData;
|
|
246
|
+
if (!isSelf) {
|
|
247
|
+
// restore user specific data if update is not self
|
|
248
|
+
this.pollData.hasVoted = hasVoted;
|
|
249
|
+
this.pollData.vote = vote;
|
|
250
|
+
}
|
|
246
251
|
|
|
247
252
|
this.pollEndedOrDeleted();
|
|
248
253
|
|
|
@@ -401,10 +406,10 @@
|
|
|
401
406
|
|
|
402
407
|
view.load();
|
|
403
408
|
},
|
|
404
|
-
update: function (pollData) {
|
|
409
|
+
update: function (pollData, uid) {
|
|
405
410
|
var pollId = pollData.info.pollId;
|
|
406
411
|
if (this.polls.hasOwnProperty(pollId)) {
|
|
407
|
-
this.polls[pollId].update(pollData);
|
|
412
|
+
this.polls[pollId].update(pollData, uid);
|
|
408
413
|
}
|
|
409
414
|
},
|
|
410
415
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div data-widget-poll-id="{./pollId}"></div>
|