Skip to content

fix: don't MARKREAD when the user has no account#205

Merged
ValwareIRC merged 1 commit into
mainfrom
fix/markread-only-when-authed
May 12, 2026
Merged

fix: don't MARKREAD when the user has no account#205
ValwareIRC merged 1 commit into
mainfrom
fix/markread-only-when-authed

Conversation

@ValwareIRC
Copy link
Copy Markdown
Contributor

Summary

Users without a logged-in account were seeing FAIL replies like "Account required for MARKREAD" when selecting channels / opening PMs. The read-marker is keyed to the user's account on the server, so without an account there's nothing to persist anyway.

The two MARKREAD send sites in src/store/index.ts:2025 (channel select) and src/store/index.ts:2233 (PM open) only gated on the `draft/read-marker` cap being acked. The cap is negotiated up-front, well before authentication completes (or never, for users who don't log in at all), so we were firing MARKREAD on every channel/PM activation regardless of account status.

Fix

Also require `ircClient.getCurrentUser(serverId)?.account` to be set before sending MARKREAD. The account field is populated by account-tag / extended-join / WHO once SASL completes; for unauthenticated users it stays empty.

Test plan

  • Connect without SASL → switching channels / opening PMs does not fire MARKREAD; no FAIL replies.
  • Connect with SASL → MARKREAD still fires on channel/PM selection and the read-marker syncs across sessions.

draft/read-marker is keyed to the user's account on the server, so
firing MARKREAD without a logged-in account just trips the server's
"Account required for MARKREAD" FAIL. The cap-only gate at the two
MARKREAD send sites (channel select + PM open) didn't catch this --
the cap is acked the moment the connection negotiates, well before
the user has authenticated (or for users who never log in at all).

Add an account check: ircClient.getCurrentUser(serverId)?.account
must be set before we send the MARKREAD line. Account-notify will
push the marker request later if the user logs in mid-session.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

Warning

Rate limit exceeded

@ValwareIRC has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 36 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aff997f0-b0df-4d1f-b71b-febdea095e71

📥 Commits

Reviewing files that changed from the base of the PR and between b5796c4 and 1f1eae6.

📒 Files selected for processing (1)
  • src/store/index.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/markread-only-when-authed

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 and usage tips.

@github-actions
Copy link
Copy Markdown

Pages Preview
Preview URL: https://fix-markread-only-when-authe.obsidianirc.pages.dev

Automated deployment preview for the PR in the Cloudflare Pages.

@ValwareIRC ValwareIRC merged commit caffa0e into main May 12, 2026
4 checks 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.

2 participants