nodebb-plugin-poll 3.2.0 → 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/lib/poll.js +3 -1
- package/lib/sockets.js +4 -2
- package/package.json +1 -1
- package/plugin.json +0 -4
- package/public/js/poll/creator.js +1 -1
- package/public/scss/style.scss +0 -25
- package/templates/poll/view.tpl +5 -6
package/lib/poll.js
CHANGED
|
@@ -101,7 +101,9 @@ Poll.getOptions = async function (pollId, withVotes = false) {
|
|
|
101
101
|
Poll.getOption = async function (pollId, option, withVotes = false) {
|
|
102
102
|
const [optionData, votes, voteCount] = await Promise.all([
|
|
103
103
|
NodeBB.db.getObject(`poll:${pollId}:options:${option}`),
|
|
104
|
-
withVotes ?
|
|
104
|
+
withVotes ?
|
|
105
|
+
NodeBB.db.getSortedSetRange(`poll:${pollId}:options:${option}:votes`, 0, -1) :
|
|
106
|
+
null,
|
|
105
107
|
Poll.getOptionVoteCount(pollId, option),
|
|
106
108
|
]);
|
|
107
109
|
|
package/lib/sockets.js
CHANGED
|
@@ -120,7 +120,7 @@ Sockets.removeVote = async function (socket, data) {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
await Vote.remove(data);
|
|
123
|
-
const pollData = Poll.get(data.pollId, socket.uid, false);
|
|
123
|
+
const pollData = await Poll.get(data.pollId, socket.uid, false);
|
|
124
124
|
NodeBB.SocketIndex.server.sockets.emit('event:poll.voteChange', pollData);
|
|
125
125
|
};
|
|
126
126
|
|
|
@@ -136,7 +136,9 @@ Sockets.getOptionDetails = async function (socket, data) {
|
|
|
136
136
|
if (!option.votes || !option.votes.length) {
|
|
137
137
|
return option;
|
|
138
138
|
}
|
|
139
|
-
const userData = await NodeBB.User.getUsersFields(option.votes, [
|
|
139
|
+
const userData = await NodeBB.User.getUsersFields(option.votes, [
|
|
140
|
+
'uid', 'username', 'userslug', 'picture',
|
|
141
|
+
]);
|
|
140
142
|
option.votes = userData;
|
|
141
143
|
|
|
142
144
|
const result = await NodeBB.Plugins.hooks.fire('filter:poll.getOptionDetails', {
|
package/package.json
CHANGED
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
|
],
|
package/public/scss/style.scss
CHANGED
|
@@ -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
|
-
}
|
package/templates/poll/view.tpl
CHANGED
|
@@ -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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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>
|