feat(member): replace can_log_in with derived active? and drop the column - #2785
Conversation
94a000d to
03dcaee
Compare
Replace the stored can_log_in boolean with a derived active? (an auth service exists), move the profile validation gates over to it, and remove the column. Members are active by having an auth service; the stored flag was misnamed and had corroded into a parity value. Follows the strong_migrations ignore-then-drop pattern.
Remove the can_log_in write from the OAuth callback (members are active by having an auth service) and only send members to the details page when they actually need additional details. A complete member who links a second provider now goes to the referer/dashboard instead of being bounced to profile completion. Closes the unconditional-redirect behaviour behind #2783.
03dcaee to
eb407ea
Compare
Closes the account-duplication confusion from the 28 Jul
|
Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
Summary
Issue #2784. Replace the stored
members.can_log_inboolean with a derivedMember#active?and drop the column; stop writingcan_log_inin the OAuth callback and gate the details redirect onrequires_additional_details?.can_log_inwas never a login gate. Its only consumer,requires_additional_details?(app/models/member.rb), gates profile completion after login, and issue #2783 showed the value had degraded into a parity artifact across 116 members. A member is active by having an auth service, so the flag duplicates easily-derived truth — this removes the column and derives it.Key behaviours:
member.save!in the callback the just-builtauth_serviceis not yet persisted, soactive?(auth_services.exists?) is false; the member becomesactive?after save./member/details/edit— they go toreferer_or_dashboard_pathinstead. This closes the unconditional-redirect part of can_log_in is silently toggled off when a member links a second auth service — 115 members affected #2783.self.ignored_columns += ['can_log_in']precedes thesafety_assureddrop). No data repair is needed: the 116 affected members self-correct to active because they have auth services.Fixes #2784 · Resolves #2783
Base
Rebased onto
master. #2780 (OAuth race fix) is merged, so this PR contains only the #2784 work; no longer stacked on the race-fix branch.Verification
51 + 12RSpec examples pass (member, callback, controller, joining, ToC specs); rubocop clean.session[:referer_path]staleness (pre-existing).Post-Deploy Monitoring & Validation
members.can_log_in. Per the strong_migrations contract, ship the code containingignored_columnsin the same release as the migration.remove_columnis reversible (re-adds the column) but cannot restore dropped values; treat the column as obsolete (impact nil).NoMethodError/ undefined-column errors oncan_log_inin Rollbar (would indicate old code running against the dropped column — i.e. a missed two-phase deploy).Member#requires_additional_details?behaves as before for new-signup and second-provider flows.