Geo: Refactor :with_verification_state scope to reduce duplication and improve maintainability
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
The :with_verification_state scope from the Geo models is confusing, as it uses .where(verification_arel_table[:verification_state].eq(verification_state_value(state)).
This hints that it could be abstracted back to the VerifiableModel class.
Furthermore, inside the Geo::VerificationState module, the VERIFICATION_STATE_VALUES constant and verification_state_value method are confusing too.
Proposal
- Abstract the
:with_verification_statescope outside of the individual ActiveRecord model classes; - Possibly use
VERIFICATION_STATE_VALUES.fetchinside theverification_state_valuemethod inGeo::VerificationStateso we fail on invalid keys;
Edited by 🤖 GitLab Bot 🤖