FIX: Export poll UI should only show for admins

This commit is contained in:
Rafael dos Santos Silva 2019-12-05 17:03:06 -03:00
parent 532fea1460
commit dbee72e92b
1 changed files with 2 additions and 1 deletions

View File

@ -630,6 +630,7 @@ createWidget("discourse-poll-buttons", {
const closed = attrs.isClosed;
const staffOnly = poll.results === "staff_only";
const isStaff = this.currentUser && this.currentUser.staff;
const isAdmin = this.currentUser && this.currentUser.admin;
const dataExplorerEnabled = this.siteSettings.data_explorer_enabled;
const hideResultsDisabled = !staffOnly && (closed || topicArchived);
const exportQueryID = this.siteSettings.poll_export_data_explorer_query_id;
@ -682,7 +683,7 @@ createWidget("discourse-poll-buttons", {
}
}
if (isStaff && dataExplorerEnabled && poll.voters > 0 && exportQueryID) {
if (isAdmin && dataExplorerEnabled && poll.voters > 0 && exportQueryID) {
contents.push(
this.attach("button", {
className: "btn btn-default export-results",