Skip to content

Commit f0ac19d

Browse files
committed
elections: show not-started member link page
1 parent 5f84de2 commit f0ac19d

4 files changed

Lines changed: 99 additions & 81 deletions

File tree

e2e/elections_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ func TestElections_AdminSettingsWorkflowAndMemberVoting(t *testing.T) {
4848
loginPageAs(t, env, memberPage, memberID)
4949
resp, err := memberPage.Goto(shareURL)
5050
require.NoError(t, err)
51-
require.Equal(t, http.StatusNotFound, resp.Status())
51+
require.Equal(t, http.StatusOK, resp.Status())
52+
expect(t).Locator(memberPage.GetByText("This is the right election link, but voting has not started yet")).ToBeVisible()
53+
expect(t).Locator(memberPage.Locator("button:has-text('Voting not started')")).ToBeVisible()
5254

5355
_, err = adminPage.Goto(env.baseURL + "/admin/config/elections/" + electionID)
5456
require.NoError(t, err)

modules/elections/elections.templ

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ templ renderMemberBallotWithError(e *election, current map[int64]bool, errorMess
263263
if errorMessage != "" {
264264
<div class="alert alert-danger" role="alert">{ errorMessage }</div>
265265
}
266+
if e.Status == statusDraft {
267+
<div class="alert alert-info">This is the right election link, but voting has not started yet. Please check back after voting opens.</div>
268+
}
266269
if e.Status == statusClosed {
267270
<div class="alert alert-secondary">This election is closed. Your submitted vote is shown below if you voted.</div>
268271
}
@@ -290,6 +293,8 @@ templ renderMemberBallotWithError(e *election, current map[int64]bool, errorMess
290293
<span class="text-secondary small">You cannot change your vote after submitting.</span>
291294
} else if len(current) > 0 {
292295
<button type="button" class="btn btn-secondary btn-lg" disabled>Vote submitted</button>
296+
} else if e.Status == statusDraft {
297+
<button type="button" class="btn btn-secondary btn-lg" disabled>Voting not started</button>
293298
} else {
294299
<button type="button" class="btn btn-secondary btn-lg" disabled>Voting closed</button>
295300
}

0 commit comments

Comments
 (0)