Clean up the way `sourceBranchLink` is passed to the merge request pipeline widget

I noticed a few oddities while working on https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14664:

  1. The source branch link is passed to the mr_widget_pipeline.vue component as an actual HTML link, not as a relative URL as expected: https://gitlab.com/gitlab-org/gitlab-ee/blob/master/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue#L41. This isn't ideal because the frontend has to use v-html in order to render this link: https://gitlab.com/gitlab-org/gitlab-ee/blob/7e5e18d00bad8e0ec9eb60bd989b66ccce6d689f/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue#L165

  2. In the parent component (mr_widget_pipeline_container.vue), this ternary looks wrong: https://gitlab.com/gitlab-org/gitlab-ee/blob/7e5e18d00bad8e0ec9eb60bd989b66ccce6d689f/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline_container.vue#L40. I think targetBranch should be targetBranchLink.

    As a side note, it's strange that a variable named targetBranch (or targetBranchLink) could eventually be passed into a component's sourceBranchLink binding. Possible bug? Or maybe the component binding just needs to be renamed to not include source.

  3. The URL of sourceBranchLink differs from sourceBranchPath. The URL of sourceBranchPath seems to be incorrect (it returns a 404): https://gitlab.com/gitlab-org/gitlab-ee/blob/7e5e18d00bad8e0ec9eb60bd989b66ccce6d689f/app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js#L110.

    In my testing, sourceBranchLink returns a link with a URL like /root/merge-trains-test/tree/root-master-patch-35819, while sourceBranchPath returns /root/merge-trains-test/-/branches/root-master-patch-35819.

Assignee Loading
Time tracking Loading