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:
-
The source branch link is passed to the
mr_widget_pipeline.vuecomponent 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 usev-htmlin 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 -
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 thinktargetBranchshould betargetBranchLink.As a side note, it's strange that a variable named
targetBranch(ortargetBranchLink) could eventually be passed into a component'ssourceBranchLinkbinding. Possible bug? Or maybe the component binding just needs to be renamed to not includesource. -
The URL of
sourceBranchLinkdiffers fromsourceBranchPath. The URL ofsourceBranchPathseems 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,
sourceBranchLinkreturns a link with a URL like/root/merge-trains-test/tree/root-master-patch-35819, whilesourceBranchPathreturns/root/merge-trains-test/-/branches/root-master-patch-35819.