Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ export default function ElectionSettings() {
}
);

// is_public is a top-level Election column, not an entry in Election.settings, so
// this can't use ElectionSwitchSetting (which writes into election.settings).
const [isPublic, setIsPublic] = useOptimisticToggle(
!!election.is_public,
async (v) => !!await updateElection(e => { e.is_public = v; })
);

// getOpenElections filters on settings.voter_access == 'open' in addition to
// is_public, so on a voter-list election the flag would have no visible effect.
const browsable = election.settings.voter_access === 'open';

// Inclusive [min_rankings, max_rankings] — drives the rank-limit selector below.
const rankOptions = Array.from({ length: max_rankings - min_rankings + 1 }, (_, i) => min_rankings + i);

Expand Down Expand Up @@ -114,6 +125,15 @@ export default function ElectionSettings() {
toggled={publicResults}
onToggle={setPublicResults}
/>
{/* Also can't use ElectionSwitchSetting — is_public lives on the
election, not on election.settings. */}
<SwitchSetting
label={t('election_settings.is_public')}
toggled={isPublic}
onToggle={setIsPublic}
disabled={election.state !== 'draft' || !browsable}
disabledMessage={browsable ? undefined : t('disabled_msgs.is_public_when_voter_list')}
/>
{/* max_rankings is set for every election (defaulting to default_rankings),
so this is always shown rather than gated behind a toggle. Kept last so the
settings read as radios, then toggles, then the rank-limit selector. */}
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/src/i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ tabulation_logs:

disabled_msgs:
ballot_updates_when_open: Only supported when election uses email list
is_public_when_voter_list: Only supported when anyone with the link can {{vote}}

#######################################
#### PRIORITY 4 : Info Bubbles ####
Expand Down
Loading