mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 17:33:27 +08:00
FEATURE: Show votes in an "on voted" poll to the creator
This required properly plumbing the guardian into the serializer. Notably, the default state in the client was not changed - if you haven't voted in the poll, you need to click the button to view the results instead of the results being immediately visible on page load. Implements https://meta.discourse.org/t/-/138108
This commit is contained in:
@ -678,6 +678,7 @@ createWidget("discourse-poll-buttons", {
|
||||
const staffOnly = poll.results === "staff_only";
|
||||
const isStaff = this.currentUser && this.currentUser.staff;
|
||||
const isAdmin = this.currentUser && this.currentUser.admin;
|
||||
const isMe = this.currentUser && post.user_id === this.currentUser.id;
|
||||
const dataExplorerEnabled = this.siteSettings.data_explorer_enabled;
|
||||
const hideResultsDisabled = !staffOnly && (closed || topicArchived);
|
||||
const exportQueryID = this.siteSettings.poll_export_data_explorer_query_id;
|
||||
@ -710,7 +711,7 @@ createWidget("discourse-poll-buttons", {
|
||||
})
|
||||
);
|
||||
} else {
|
||||
if (poll.get("results") === "on_vote" && !attrs.hasVoted) {
|
||||
if (poll.get("results") === "on_vote" && !attrs.hasVoted && !isMe) {
|
||||
contents.push(infoTextHtml(I18n.t("poll.results.vote.title")));
|
||||
} else if (poll.get("results") === "on_close" && !closed) {
|
||||
contents.push(infoTextHtml(I18n.t("poll.results.closed.title")));
|
||||
|
Reference in New Issue
Block a user