Skip to content

Fix user activity indicator to show days remaining until expiry#450

Merged
stefan-burke merged 2 commits intomainfrom
claude/fix-active-status-logic-TpdMa
Feb 11, 2026
Merged

Fix user activity indicator to show days remaining until expiry#450
stefan-burke merged 2 commits intomainfrom
claude/fix-active-status-logic-TpdMa

Conversation

@stefan-burke
Copy link
Copy Markdown
Member

Summary

Fixed the user_activity_indicator helper method to correctly display the number of days remaining until a user's account expires, rather than days since account creation.

Key Changes

  • Corrected days calculation: Changed from (Date.current - user.created_at.to_date) to (user.active_until - Date.current) to show days remaining until expiry instead of account age
  • Added nil check: Added early return when active_until is nil to prevent errors and render nothing for users without an expiry date
  • Added comprehensive test coverage: Added three test cases covering:
    • Active users showing days remaining
    • Inactive users showing days since expiry
    • Users with nil active_until rendering empty string

Implementation Details

The helper now properly uses the active_until field to calculate user status, making the indicator more meaningful for tracking subscription or license expiration dates. The method returns an empty safe HTML string when no expiry date is set, allowing it to be safely used in templates without conditional checks.

https://claude.ai/code/session_01GPjKmCuVw2i1mzMee2aMTS

…d_at

The active status on /users was showing days since account creation
rather than days remaining until the active_until date expires. Changed
the calculation for active users from (Date.current - created_at) to
(active_until - Date.current) so it correctly shows remaining days.

https://claude.ai/code/session_01GPjKmCuVw2i1mzMee2aMTS
…d_at

The active status on /users was showing days since account creation
rather than days remaining until the active_until date expires. Changed
the calculation for active users from (Date.current - created_at) to
(active_until - Date.current) so it correctly shows remaining days.

When active_until is nil (always-active accounts), render nothing
instead of showing a misleading indicator.

https://claude.ai/code/session_01GPjKmCuVw2i1mzMee2aMTS
@stefan-burke stefan-burke added this pull request to the merge queue Feb 11, 2026
Merged via the queue into main with commit f7fcfb9 Feb 11, 2026
25 of 26 checks passed
@stefan-burke stefan-burke deleted the claude/fix-active-status-logic-TpdMa branch February 11, 2026 11:54
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