From ef4877e009e6c164fb076caa4682f23b41bacd0c Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 28 Mar 2016 12:17:37 -0400 Subject: [PATCH] FIX: Stability issues with multiple polls --- .../assets/javascripts/initializers/extend-for-poll.js.es6 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/poll/assets/javascripts/initializers/extend-for-poll.js.es6 b/plugins/poll/assets/javascripts/initializers/extend-for-poll.js.es6 index c27957849..68fe20140 100644 --- a/plugins/poll/assets/javascripts/initializers/extend-for-poll.js.es6 +++ b/plugins/poll/assets/javascripts/initializers/extend-for-poll.js.es6 @@ -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;