Commit 44dc4173 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch '25264-ref-commit' into 'master'

Change ref property to commitRef

## What does this MR do?
Changes `ref` prop to `commitRef` because `ref` is a reserved word in Vue.js

## Does this MR meet the acceptance criteria?

- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- Tests
  - [ ] Added for this feature/bug
  - [ ] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?
Closes #25264

//cc @selfup

See merge request !7901
parents 2f91c0ee f83927eb
...@@ -451,7 +451,7 @@ ...@@ -451,7 +451,7 @@
<div v-if="!isFolder && hasLastDeploymentKey" class="js-commit-component"> <div v-if="!isFolder && hasLastDeploymentKey" class="js-commit-component">
<commit-component <commit-component
:tag="commitTag" :tag="commitTag"
:ref="commitRef" :commit_ref="commitRef"
:commit_url="commitUrl" :commit_url="commitUrl"
:short_sha="commitShortSha" :short_sha="commitShortSha"
:title="commitTitle" :title="commitTitle"
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* name * name
* ref_url * ref_url
*/ */
ref: { commit_ref: {
type: Object, type: Object,
required: false, required: false,
default: () => ({}), default: () => ({}),
...@@ -79,8 +79,8 @@ ...@@ -79,8 +79,8 @@
* *
* @returns {Boolean} * @returns {Boolean}
*/ */
hasRef() { hasCommitRef() {
return this.ref && this.ref.name && this.ref.ref_url; return this.commit_ref && this.commit_ref.name && this.commit_ref.ref_url;
}, },
/** /**
...@@ -131,15 +131,15 @@ ...@@ -131,15 +131,15 @@
template: ` template: `
<div class="branch-commit"> <div class="branch-commit">
<div v-if="hasRef" class="icon-container"> <div v-if="hasCommitRef" class="icon-container">
<i v-if="tag" class="fa fa-tag"></i> <i v-if="tag" class="fa fa-tag"></i>
<i v-if="!tag" class="fa fa-code-fork"></i> <i v-if="!tag" class="fa fa-code-fork"></i>
</div> </div>
<a v-if="hasRef" <a v-if="hasCommitRef"
class="monospace branch-name" class="monospace branch-name"
:href="ref.ref_url"> :href="commit_ref.ref_url">
{{ref.name}} {{commit_ref.name}}
</a> </a>
<div class="icon-container commit-icon commit-icon-container"></div> <div class="icon-container commit-icon commit-icon-container"></div>
......
---
title: Change ref property to commitRef in vue commit component
merge_request: 7901
author:
...@@ -10,7 +10,7 @@ describe('Commit component', () => { ...@@ -10,7 +10,7 @@ describe('Commit component', () => {
el: document.querySelector('.test-commit-container'), el: document.querySelector('.test-commit-container'),
propsData: { propsData: {
tag: false, tag: false,
ref: { commit_ref: {
name: 'master', name: 'master',
ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', ref_url: 'http://localhost/namespace2/gitlabhq/tree/master',
}, },
...@@ -34,7 +34,7 @@ describe('Commit component', () => { ...@@ -34,7 +34,7 @@ describe('Commit component', () => {
props = { props = {
tag: true, tag: true,
ref: { commit_ref: {
name: 'master', name: 'master',
ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', ref_url: 'http://localhost/namespace2/gitlabhq/tree/master',
}, },
...@@ -59,11 +59,11 @@ describe('Commit component', () => { ...@@ -59,11 +59,11 @@ describe('Commit component', () => {
}); });
it('should render a link to the ref url', () => { it('should render a link to the ref url', () => {
expect(component.$el.querySelector('.branch-name').getAttribute('href')).toEqual(props.ref.ref_url); expect(component.$el.querySelector('.branch-name').getAttribute('href')).toEqual(props.commit_ref.ref_url);
}); });
it('should render the ref name', () => { it('should render the ref name', () => {
expect(component.$el.querySelector('.branch-name').textContent).toContain(props.ref.name); expect(component.$el.querySelector('.branch-name').textContent).toContain(props.commit_ref.name);
}); });
it('should render the commit short sha with a link to the commit url', () => { it('should render the commit short sha with a link to the commit url', () => {
...@@ -103,7 +103,7 @@ describe('Commit component', () => { ...@@ -103,7 +103,7 @@ describe('Commit component', () => {
fixture.set('<div class="test-commit-container"></div>'); fixture.set('<div class="test-commit-container"></div>');
props = { props = {
tag: false, tag: false,
ref: { commit_ref: {
name: 'master', name: 'master',
ref_url: 'http://localhost/namespace2/gitlabhq/tree/master', ref_url: 'http://localhost/namespace2/gitlabhq/tree/master',
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment