Overide MR#approved? to include #temporarily_unapproved? state
Since approvals can be removed async, we added ApprovalState#temporarily_unapproved?
as a shim to carry us until we can remove that delay. Since we have many instances of MergeRequest#approved?
sprinkled around the code, it makes more sense to overide #approved?
to include both the state machine check as well as #temporarily_unapproved?
My initial thought here would be like
alias_method :approved_in_state_machine?, :approved?
def approved?
approved_in_state_machine? && !approval_state.temporarily_unapproved?
end
Additionally, take a look through the code base for any existing uses of #temporarily_unapproved?
and if they are &&
with approved?
see if we can remove them.
Edited by Kerri Miller