FIX: Remove 'staff_only' results option for non-staff (#8565)
This commit is contained in:
parent
e916bd7ea0
commit
44612f900e
|
@ -62,7 +62,7 @@ export default Controller.extend({
|
||||||
closedPollResult,
|
closedPollResult,
|
||||||
staffPollResult
|
staffPollResult
|
||||||
) {
|
) {
|
||||||
return [
|
let options = [
|
||||||
{
|
{
|
||||||
name: I18n.t("poll.ui_builder.poll_result.always"),
|
name: I18n.t("poll.ui_builder.poll_result.always"),
|
||||||
value: alwaysPollResult
|
value: alwaysPollResult
|
||||||
|
@ -74,12 +74,15 @@ export default Controller.extend({
|
||||||
{
|
{
|
||||||
name: I18n.t("poll.ui_builder.poll_result.closed"),
|
name: I18n.t("poll.ui_builder.poll_result.closed"),
|
||||||
value: closedPollResult
|
value: closedPollResult
|
||||||
},
|
|
||||||
{
|
|
||||||
name: I18n.t("poll.ui_builder.poll_result.staff"),
|
|
||||||
value: staffPollResult
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
if (this.currentUser.staff) {
|
||||||
|
options.push({
|
||||||
|
name: I18n.t("poll.ui_builder.poll_result.staff"),
|
||||||
|
value: staffPollResult
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return options;
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("pollType", "regularPollType")
|
@computed("pollType", "regularPollType")
|
||||||
|
|
|
@ -311,3 +311,25 @@ test("multiple pollOutput", function(assert) {
|
||||||
"it should return the right output"
|
"it should return the right output"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("staff_only option is not present for non-staff", function(assert) {
|
||||||
|
const controller = this.subject();
|
||||||
|
controller.currentUser = { staff: false };
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
controller.pollResults.filter(result => result.value === "staff_only")
|
||||||
|
.length === 0,
|
||||||
|
"staff_only is not present"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("staff_only option is present for staff", function(assert) {
|
||||||
|
const controller = this.subject();
|
||||||
|
controller.currentUser = { staff: true };
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
controller.pollResults.filter(result => result.value === "staff_only")
|
||||||
|
.length === 1,
|
||||||
|
"staff_only is present"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue