CE backport of design-management-issue-tab

Backports template and Vue changes from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9632 to CE
This commit is contained in:
Phil Hughes 2019-02-20 14:51:06 +00:00
parent d7db2232f0
commit 810a8b78b6
No known key found for this signature in database
GPG key ID: 32245528C52E0F9F
4 changed files with 19 additions and 3 deletions

View file

@ -90,8 +90,15 @@ export default {
this.fetchNotes(); this.fetchNotes();
} }
}, },
allDiscussions() {
if (this.discussonsCount) {
this.discussonsCount.textContent = this.allDiscussions.length;
}
},
}, },
created() { created() {
this.discussonsCount = document.querySelector('.js-discussions-count');
this.setNotesData(this.notesData); this.setNotesData(this.notesData);
this.setNoteableData(this.noteableData); this.setNoteableData(this.noteableData);
this.setUserData(this.userData); this.setUserData(this.userData);

View file

@ -5,7 +5,7 @@
= link_to 'Reopen issue', issue_path(@issue, issue: {state_event: :reopen}, format: 'json'), data: {original_text: "Reopen issue", alternative_text: "Comment & reopen issue"}, class: "btn btn-nr btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue' = link_to 'Reopen issue', issue_path(@issue, issue: {state_event: :reopen}, format: 'json'), data: {original_text: "Reopen issue", alternative_text: "Comment & reopen issue"}, class: "btn btn-nr btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue'
= link_to 'Close issue', issue_path(@issue, issue: {state_event: :close}, format: 'json'), data: {original_text: "Close issue", alternative_text: "Comment & close issue"}, class: "btn btn-nr btn-close btn-comment js-note-target-close #{issue_button_visibility(@issue, true)}", title: 'Close issue' = link_to 'Close issue', issue_path(@issue, issue: {state_event: :close}, format: 'json'), data: {original_text: "Close issue", alternative_text: "Comment & close issue"}, class: "btn btn-nr btn-close btn-comment js-note-target-close #{issue_button_visibility(@issue, true)}", title: 'Close issue'
%section.js-vue-notes-event %section.issuable-discussion.js-vue-notes-event
#js-vue-notes{ data: { notes_data: notes_data(@issue).to_json, #js-vue-notes{ data: { notes_data: notes_data(@issue).to_json,
noteable_data: serialize_issuable(@issue), noteable_data: serialize_issuable(@issue),
noteable_type: 'Issue', noteable_type: 'Issue',

View file

@ -88,7 +88,6 @@
#js-vue-discussion-filter{ data: { default_filter: current_user&.notes_filter_for(@issue), notes_filters: UserPreference.notes_filters.to_json } } #js-vue-discussion-filter{ data: { default_filter: current_user&.notes_filter_for(@issue), notes_filters: UserPreference.notes_filters.to_json } }
= render 'new_branch' unless @issue.confidential? = render 'new_branch' unless @issue.confidential?
%section.issuable-discussion = render_if_exists 'projects/issues/discussion'
= render 'projects/issues/discussion'
= render 'shared/issuable/sidebar', issuable_sidebar: @issuable_sidebar, assignees: @issue.assignees = render 'shared/issuable/sidebar', issuable_sidebar: @issuable_sidebar, assignees: @issue.assignees

View file

@ -83,6 +83,8 @@ describe('note_app', () => {
describe('render', () => { describe('render', () => {
beforeEach(() => { beforeEach(() => {
setFixtures('<div class="js-discussions-count"></div>');
Vue.http.interceptors.push(mockData.individualNoteInterceptor); Vue.http.interceptors.push(mockData.individualNoteInterceptor);
wrapper = mountComponent(); wrapper = mountComponent();
}); });
@ -127,6 +129,14 @@ describe('note_app', () => {
it('should render form comment button as disabled', () => { it('should render form comment button as disabled', () => {
expect(wrapper.find('.js-note-new-discussion').attributes('disabled')).toEqual('disabled'); expect(wrapper.find('.js-note-new-discussion').attributes('disabled')).toEqual('disabled');
}); });
it('updates discussions badge', done => {
setTimeout(() => {
expect(document.querySelector('.js-discussions-count').textContent).toEqual('2');
done();
});
});
}); });
describe('while fetching data', () => { describe('while fetching data', () => {