Skip to content

Load the API user after sign-in so an admin is recognised at once - #2260

Open
pkvach wants to merge 1 commit into
umputun:masterfrom
pkvach:fix-admin-flag-after-signin
Open

pkvach wants to merge 1 commit into
umputun:masterfrom
pkvach:fix-admin-flag-after-signin

Conversation

@pkvach

@pkvach pkvach commented Oct 5, 2026

Copy link
Copy Markdown

Fixes #2205

Sign-in endpoints answer with the auth library's user, which keeps the admin flag under attrs. The widget stored that user as-is, so it treated an admin as a regular user until the next page load. The edit countdown on an admin's freshly posted comment came from that.

  • Anonymous, email and Telegram sign-in now fetch /user once the endpoint succeeds and return that user. The fetch skips the /auth/status probe that getUser makes first, because that probe tells nothing new right after a successful sign-in.
  • OAuth is unchanged: it already loads the user through getUser after the popup closes.

Sign-in endpoints answer with the auth library's user, which keeps the
admin flag under attrs. The widget therefore treated an admin as a
regular user until the next page load. The countdown on an admin's
freshly posted comment came from that. Anonymous, email and Telegram
sign-in now fetch /user after the endpoint succeeds.

Fixes umputun#2205
@pkvach
pkvach requested a review from umputun as a code owner October 5, 2026 21:06
@codecov

codecov Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.23%. Comparing base (d9254d2) to head (74f232a).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2260      +/-   ##
==========================================
+ Coverage   74.01%   74.23%   +0.21%     
==========================================
  Files         129      129              
  Lines        3745     3749       +4     
  Branches      830      829       -1     
==========================================
+ Hits         2772     2783      +11     
+ Misses        967      960       -7     
  Partials        6        6              
Flag Coverage Δ
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

An admin's own new comment shows an edit countdown while ADMIN_EDIT is enabled

2 participants