Skip to content

fix: record votekick rate-limit timestamp only after all guards pass#540

Open
xpoes123 wants to merge 1 commit into
qbreader:mainfrom
xpoes123:fix/votekick-ratelimit-timestamp
Open

fix: record votekick rate-limit timestamp only after all guards pass#540
xpoes123 wants to merge 1 commit into
qbreader:mainfrom
xpoes123:fix/votekick-ratelimit-timestamp

Conversation

@xpoes123

@xpoes123 xpoes123 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

In votekickInit, the 90-second rate-limit timestamp was recorded before the duplicate-votekick and eligibility checks, so a rejected initiation still consumed the initiator's full cooldown window.

Problem

In server/multiplayer/ServerMultiplayerRoomMixin.js, this.lastVotekickTime[userId] was assigned immediately after the rate-limit guard — before the loop that checks whether a votekick against the target already exists. If that loop returned early (duplicate or ineligible target), the timestamp was already written, locking the initiator out for 90 seconds even though no votekick was created.

Changes

  • Moves this.lastVotekickTime[userId] = currentTime to just before the new Votekick(...) call, after all early-return guards have passed.

Risk & testing

Single-line relocation; the rate-limit guard logic and the 90-second threshold are unchanged. The cooldown now only starts when a votekick is genuinely initiated, which matches the intended behavior. semistandard and node --check pass.

@xpoes123 xpoes123 changed the title fix: set votekick rate-limit timestamp after validity checks fix: record votekick rate-limit timestamp only after all guards pass Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant