Skip to content

feat(reviews): independent per-user daily and weekly review toggles - #111

Merged
asiniscalchi merged 2 commits into
mainfrom
feature/review-toggles-command
Sep 3, 2026
Merged

feat(reviews): independent per-user daily and weekly review toggles#111
asiniscalchi merged 2 commits into
mainfrom
feature/review-toggles-command

Conversation

@a-mandala

Copy link
Copy Markdown
Collaborator

Summary

  • Extends the per-user review opt-out from PR feat(reviews): per-user review opt-out with /reviews command #110 into independent daily and weekly toggles, stored per tenant in SQLite (migration 0017 splits reviews_enabled into daily_enabled / weekly_enabled, seeded from the old combined value so existing opt-outs are preserved; absence of a row still defaults to ON for everyone).
  • /reviews now shows both settings; /reviews daily on|off and /reviews weekly on|off toggle one; /reviews on|off remains a shorthand for both. On-demand /day_review / /week_review are unaffected.
  • The daily delivery worker skips generation/delivery when the user's daily preference is off; the weekly worker does the same for the weekly preference. The global FROID_DAILY_REVIEW_DELIVERY_ENABLED / FROID_WEEK_REVIEW_WORKER_ENABLED env switches remain the master switches on top.

Testing

  • New tests: repository persistence of each flag independently (defaults, read-back, re-enable, idempotency, no cross-effect); worker tests proving the daily worker skips when daily is off (no generation, no send) yet still delivers when only weekly is off, and the mirror for the weekly worker; adapter parsing tests for the new command forms (case-insensitive, usage fallback).
  • Local CI-equivalent checks all green: cargo fmt --all --check, cargo check --locked --all-targets, cargo clippy --locked --all-targets -- -D warnings, cargo test --locked --all-targets (608 tests passing, 0 failed). Both commits compile individually.
  • Not verified locally: real Telegram delivery end-to-end (no bot token/network in this environment) and migration 0017 against a production database with pre-existing opt-out rows (backfill logic covered only by review).

Adds a migration splitting the single review_preferences flag into
independent daily_enabled and weekly_enabled columns (seeded from the
old combined value so existing opt-outs keep their behaviour, which
then defaults to enabled for everyone else) and reworks
ReviewPreferenceRepository around per-review getters and setters.

The daily and weekly delivery workers now consult their own
preference, and the /reviews backend reports and sets the two flags
independently while keeping /reviews on|off as a shorthand for both.
Parses "/reviews daily on|off" and "/reviews weekly on|off" into the
new per-review commands, keeps "/reviews on|off" applying to both, and
shows both settings in "/reviews". Documents the independent toggles
and their relationship to the global operator switches in the README.
@asiniscalchi
asiniscalchi merged commit aeb15af into main Sep 3, 2026
3 checks passed
@asiniscalchi
asiniscalchi deleted the feature/review-toggles-command branch September 3, 2026 07:06
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.

2 participants