mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: Stability issues with multiple polls
This commit is contained in:
parent
6b01287e98
commit
ef4877e009
1 changed files with 3 additions and 1 deletions
|
@ -67,6 +67,7 @@ function initializePolls(api) {
|
|||
if (!$polls.length) { return; }
|
||||
|
||||
const post = helper.getModel();
|
||||
api.preventCloak(post.id);
|
||||
const votes = post.get('polls_votes') || {};
|
||||
|
||||
post.pollsChanged();
|
||||
|
@ -82,11 +83,12 @@ function initializePolls(api) {
|
|||
const $poll = $(pollElem);
|
||||
|
||||
const pollName = $poll.data("poll-name");
|
||||
const pollId = `${pollName}-${post.id}`;
|
||||
const pollView = createPollView(helper.container, post, polls[pollName], votes[pollName]);
|
||||
|
||||
$poll.replaceWith($div);
|
||||
Em.run.next(() => pollView.renderer.replaceIn(pollView, $div[0]));
|
||||
postPollViews[pollName] = pollView;
|
||||
postPollViews[pollId] = pollView;
|
||||
});
|
||||
|
||||
_pollViews = postPollViews;
|
||||
|
|
Loading…
Reference in a new issue