Commit b1d3bb0a authored by sstern's avatar sstern

Add ref path from the api for issuables list

Add ref path being returned from the api
instead of creating locally in the component
parent dd902ebc
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* This is tightly coupled to projects/issues/_issue.html.haml, * This is tightly coupled to projects/issues/_issue.html.haml,
* any changes done to the haml need to be reflected here. * any changes done to the haml need to be reflected here.
*/ */
import { escape, isNumber } from 'underscore'; import { escape, isNumber } from 'lodash';
import { GlLink, GlTooltipDirective as GlTooltip } from '@gitlab/ui'; import { GlLink, GlTooltipDirective as GlTooltip } from '@gitlab/ui';
import { import {
dateInWords, dateInWords,
...@@ -19,8 +19,6 @@ import { mergeUrlParams } from '~/lib/utils/url_utility'; ...@@ -19,8 +19,6 @@ import { mergeUrlParams } from '~/lib/utils/url_utility';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import IssueAssignees from '~/vue_shared/components/issue/issue_assignees.vue'; import IssueAssignees from '~/vue_shared/components/issue/issue_assignees.vue';
const ISSUE_TOKEN = '#';
export default { export default {
components: { components: {
Icon, Icon,
...@@ -119,8 +117,7 @@ export default { ...@@ -119,8 +117,7 @@ export default {
); );
}, },
referencePath() { referencePath() {
// TODO: The API should return the reference path (it doesn't now) https://gitlab.com/gitlab-org/gitlab/issues/31301 return this.issuable.references.relative;
return `${ISSUE_TOKEN}${this.issuable.iid}`;
}, },
updatedDateString() { updatedDateString() {
return formatDate(new Date(this.issuable.updated_at), 'mmm d, yyyy h:MMtt'); return formatDate(new Date(this.issuable.updated_at), 'mmm d, yyyy h:MMtt');
...@@ -230,7 +227,7 @@ export default { ...@@ -230,7 +227,7 @@ export default {
</div> </div>
<div class="issuable-info"> <div class="issuable-info">
<span>{{ referencePath }}</span> <span class="js-ref-path">{{ referencePath }}</span>
<span class="d-none d-sm-inline-block mr-1"> <span class="d-none d-sm-inline-block mr-1">
&middot; &middot;
......
...@@ -122,6 +122,10 @@ describe('Issuable component', () => { ...@@ -122,6 +122,10 @@ describe('Issuable component', () => {
expect(finder().exists()).toBe(false); expect(finder().exists()).toBe(false);
}); });
it('show relative reference path', () => {
expect(wrapper.find('.js-ref-path').text()).toBe(issuable.references.relative);
});
it('does not have closed text', () => { it('does not have closed text', () => {
expect(wrapper.text()).not.toContain(TEXT_CLOSED); expect(wrapper.text()).not.toContain(TEXT_CLOSED);
}); });
......
...@@ -26,6 +26,9 @@ export const simpleIssue = { ...@@ -26,6 +26,9 @@ export const simpleIssue = {
web_url: 'http://localhost:3001/h5bp/html5-boilerplate/issues/31', web_url: 'http://localhost:3001/h5bp/html5-boilerplate/issues/31',
has_tasks: false, has_tasks: false,
weight: null, weight: null,
references: {
relative: 'html-boilerplate#45',
},
}; };
export const testLabels = [ export const testLabels = [
......
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