UX: Create polls with public=true by default (#24332)

In the vast majority of cases, people want poll voters to be public. Previously, the checkbox for this was hidden behind the 'show advanced' settings in the poll builder UI.

This commit makes three changes to improve the experience:

1. Add `public=true|false` to poll markup (previously it would only be added when true

2. Bring the 'public' switch outside the 'show advanced' section for improved visibility

3. Change the default to 'true'
This commit is contained in:
David Taylor
2023-11-13 09:07:51 +11:00
committed by GitHub
parent cdbe0f74e8
commit 7e37e3e824
4 changed files with 33 additions and 32 deletions
@@ -145,6 +145,15 @@
{{/unless}}
{{/unless}}
<div class="input-group poll-public">
<DToggleSwitch
@state={{this.publicPoll}}
@label="poll.ui_builder.poll_public.label"
class="poll-toggle-public"
{{on "click" this.togglePublic}}
/>
</div>
{{#if this.showAdvanced}}
<div class="input-group poll-allowed-groups">
<label class="input-group-label">{{i18n
@@ -213,19 +222,6 @@
</div>
</div>
{{/unless}}
{{#unless this.isPie}}
<div class="input-group poll-checkbox column">
<label>
<Input
@type="checkbox"
@checked={{this.publicPoll}}
class="poll-toggle-public"
/>
{{i18n "poll.ui_builder.poll_public.label"}}
</label>
</div>
{{/unless}}
{{/if}}
</:body>
<:footer>
@@ -30,7 +30,7 @@ export default class PollUiBuilderModal extends Component {
pollAutoClose;
pollResult = ALWAYS_POLL_RESULT;
chartType = BAR_CHART_TYPE;
publicPoll = false;
publicPoll = true;
@or("showAdvanced", "isNumber") showNumber;
@gt("pollOptions.length", 1) canRemoveOption;
@@ -174,9 +174,7 @@ export default class PollUiBuilderModal extends Component {
if (pollType === NUMBER_POLL_TYPE) {
pollHeader += ` step=${step}`;
}
if (publicPoll) {
pollHeader += ` public=true`;
}
pollHeader += ` public=${publicPoll ? "true" : "false"}`;
if (chartType && pollType !== NUMBER_POLL_TYPE) {
pollHeader += ` chartType=${chartType}`;
}
@@ -381,4 +379,9 @@ export default class PollUiBuilderModal extends Component {
event?.preventDefault();
this.set("pollType", pollType);
}
@action
togglePublic() {
this.set("publicPoll", !this.publicPoll);
}
}