Add an explicit license check for merge train conditionals in `ready_to_merge`
Summary
In the ready_to_merge widget and mixins, we have a check that is implicitly checking the user license, but nothing explicit. Example:
if (this.mr.preferredAutoMergeStrategy === MTWPS_MERGE_STRATEGY)
This condition can only be true if the user turned the merge train on in the settings and so we know implicitly that the user has the right tier access.
Comment about how to proceed from @sstern:
We can draw our attention to
ee/app/models/license.rband see thatmerge_trainsare in EEP. So well need to check if Premium is available to show this component. Pushing this to the frontend usingproject.feature_available?(:merge_trains), then we can access this inthis.glFeatureson the FE. For example, look at how we handleee/app/controllers/concerns/ee/boards_actions.rbin#push_wip_limits
Improvements
It would be better to have a condition that is explicit for all of these so that:
- It's easier to read
- Feel safer to modify as we can see the tier it's behind
- If a bug ever occurred in the settings section, it would not affect the widget itself.
Risks
Make sure Merge train still work for Premium/Silver and Ultimate only.
Involved components
ee/app/assets/javascripts/vue_merge_request_widget/mixins/ready_to_merge.js
app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue