Skip to content

feat: cancel voting (frontend) - #6465

Open
mating02 wants to merge 4 commits into
feat/mg/cancel-voting-backend-6396from
feat/mg/cancel-voting-frontend-6396
Open

feat: cancel voting (frontend)#6465
mating02 wants to merge 4 commits into
feat/mg/cancel-voting-backend-6396from
feat/mg/cancel-voting-frontend-6396

Conversation

@mating02

@mating02 mating02 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Description

I implemented a new button right beneath the stop voting button that uses the backend cancel feature to stop the voting without evaluation.

Changelog

  • added cancelVoting feature in thunks.ts
  • extended changeVotingStatus function in votings.ts
  • added cancel Voting button in VotingDialog.tsx

Checklist

  • I have performed a self-review of my own code
  • I have written and understand every part of this contribution myself - if AI tools were used, I have thoroughly reviewed and verified all changes
  • I have commented my code, particularly in hard-to-understand areas
  • The light- and dark-theme are both supported and tested
  • The design was implemented and is responsive for all devices and screen sizes
  • The application was tested in the most commonly used browsers (e.g. Chrome, Firefox, Safari)

Visual Changes

Screenshot 2026-08-10 at 14 16 12 Screenshot 2026-08-10 at 14 17 17

Stack created with GitHub Stacks CLIGive Feedback 💬

@mating02 mating02 added the Refinement Required Need to be refined label Aug 7, 2026
@Planlos5000 Planlos5000 linked an issue Aug 7, 2026 that may be closed by this pull request
5 tasks
@Planlos5000 Planlos5000 added the feat This pull request or issue adds a new feature label Aug 7, 2026
@mating02
mating02 marked this pull request as ready for review August 10, 2026 12:24
@mating02
mating02 force-pushed the feat/mg/cancel-voting-backend-6396 branch from ab9ee48 to b93e843 Compare August 10, 2026 12:37
@mating02
mating02 force-pushed the feat/mg/cancel-voting-frontend-6396 branch from b07c1ce to ebf82ab Compare August 10, 2026 12:46
@mating02 mating02 added Review Needed This pull request is ready for review and removed Refinement Required Need to be refined labels Aug 10, 2026
Comment thread src/api/votings.ts Outdated
Comment on lines +30 to +42
changeVotingStatus: async (board: string, voting: string, status?: string) => {
try {
const response = await fetch(`${SERVER_HTTP_URL}/boards/${board}/votings/${voting}`, {
const options: RequestInit = {
method: "PUT",
credentials: "include",
});
};

if (typeof status !== "undefined") {
options.body = JSON.stringify({status});
options.headers = {"Content-Type": "application/json"};
}

const response = await fetch(`${SERVER_HTTP_URL}/boards/${board}/votings/${voting}`, options);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the status should always be set and should not be able to undefined or null. Also use the VotingStatus type

Comment on lines +49 to +52
const abortVoting = () => {
dispatch(cancelVoting(voting!));
navigate("..");
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be consistent with the naming. Is it now abort or cancel?

@mating02
mating02 force-pushed the feat/mg/cancel-voting-backend-6396 branch from b93e843 to 772d388 Compare August 12, 2026 12:03
@mating02
mating02 force-pushed the feat/mg/cancel-voting-frontend-6396 branch 2 times, most recently from ac1ba8d to 619ec6d Compare August 12, 2026 12:07
@mating02
mating02 force-pushed the feat/mg/cancel-voting-frontend-6396 branch from 393a10d to 7776c8b Compare August 17, 2026 09:01
@mating02
mating02 force-pushed the feat/mg/cancel-voting-backend-6396 branch from 568dfa4 to fdd8eee Compare August 17, 2026 09:01
<label>{t("VoteConfigurationButton.stopVoting")}</label>
</button>

<button className="voting-dialog__start-button voting-dialog__cancel-button" data-testid="voting-dialog__cancel-button" onClick={() => abort_voting()}>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be "abort" instead of "cancel"

navigate("..");
};

const abort_voting = () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snake case‽ this ain't python

Comment thread src/api/votings.ts
},

changeVotingStatus: async (board: string, voting: string) => {
changeVotingStatus: async (board: string, voting: string, status?: VotingStatus) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status can be non-nullable

Comment thread src/api/votings.ts
changeVotingStatus: async (board: string, voting: string, status?: VotingStatus) => {
try {
const response = await fetch(`${SERVER_HTTP_URL}/boards/${board}/votings/${voting}`, {
const options: RequestInit = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer the options inline inside the fetch rather than an extra object, since we do it that way in all other places (not to say this is bad, I just want it to be the same if possible)

Comment thread src/api/votings.ts
method: "PUT",
credentials: "include",
});
body: JSON.stringify({ status: status }),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

properties with the same name and value can be shortened like this: {status}


await retryable(
() => API.changeVotingStatus(boardId, payload),
() => API.changeVotingStatus(boardId, payload, "CLOSED"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be "ABORT(ED)" here also

@Schwehn42 Schwehn42 added Changes Requested Changes requested by the reviewer and removed Review Needed This pull request is ready for review labels Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes Requested Changes requested by the reviewer feat This pull request or issue adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancel a voting

3 participants