Skip to content

Make issuable state declarations consistent

Heinrich Lee Yu requested to merge issuable-state-consistent into master

What does this MR do and why?

For Issue and MergeRequest, we use the state methods in Issuable that work like that of ActiveRecord enums. We also depend on state_machine to declare methods like opened? and closed?

For Epic, we actually declare an enum on state_id and then alias it to state.

This makes things consistent by changing Epic to use the same approach used by Issue and MergeRequest.

We need this for the Rails 7.1 upgrade because there was a change in the way alias_attribute works and it no longer overrides the instance methods declared on Issuable. I think having the subclasses all use the same approach is also better.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Heinrich Lee Yu

Merge request reports