Skip to content

fix(freeleech): address review feedback from #58 - #63

Merged
florianjs merged 1 commit into
mainfrom
fix/freeleech-review
Oct 8, 2026
Merged

florianjs merged 1 commit into
mainfrom
fix/freeleech-review

Conversation

@florianjs

Copy link
Copy Markdown
Owner

Follow-up to #58, addressing the CodeRabbit review.

  • Zero duration: 0 hours started an open-ended freeleech, because the editor sent null for 0. It now sends null only when the field is empty, and the API refuses 0 with a 400.
  • Atomic settings: the enabled flag and the end date are written in a single transaction through a new setSettings helper. Before, a stop that cleared the end date and then failed to write enabled=false left an open-ended freeleech.
  • Banner:
    • it reloads when the user signs in or out;
    • it clears when there is no user;
    • the end date is checked locally every 30 s, so the banner disappears on time instead of up to 5 minutes later.

Test plan

  • npx vitest run, npm run build
  • On a production build:
    • 0 hours returns 400;
    • 2 hours sets an end date;
    • stop clears both settings;
    • no duration starts an open-ended freeleech
  • Start a 1-minute freeleech (by editing the setting) and check that the banner disappears on time

🤖 Generated with Claude Code

- a duration of 0 hours is refused instead of starting an open-ended freeleech
- enabled flag and end date are written in one transaction, so a failed stop
  can no longer turn a timed freeleech into an open-ended one
- the banner reloads when the user signs in or out and disappears exactly at
  the end date instead of waiting for the next poll

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 31d63022-d671-4b49-86c3-6f068138df43
📥 Commits

Reviewing files that changed from the base of the PR and between 77adb75 and 05922e4.

📒 Files selected for processing (4)
  • app/components/admin/Freeleech.vue
  • app/layouts/default.vue
  • server/api/admin/freeleech.put.ts
  • server/utils/settings.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@florianjs
florianjs merged commit 22bd096 into main Oct 8, 2026
1 check passed
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