Fixes Web IDE not loading merge request files
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/60243
This commit is contained in:
parent
6a2e10e38b
commit
1d04ae7458
4 changed files with 47 additions and 0 deletions
|
@ -7,6 +7,8 @@ export default {
|
|||
});
|
||||
},
|
||||
[types.SET_MERGE_REQUEST](state, { projectPath, mergeRequestId, mergeRequest }) {
|
||||
const existingMergeRequest = state.projects[projectPath].mergeRequests[mergeRequestId] || {};
|
||||
|
||||
Object.assign(state.projects[projectPath], {
|
||||
mergeRequests: {
|
||||
[mergeRequestId]: {
|
||||
|
@ -15,6 +17,7 @@ export default {
|
|||
changes: [],
|
||||
versions: [],
|
||||
baseCommitSha: null,
|
||||
...existingMergeRequest,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fixed Web IDE not loading merge request files
|
||||
merge_request:
|
||||
author:
|
||||
type: fixed
|
21
spec/features/ide/user_opens_merge_request_spec.rb
Normal file
21
spec/features/ide/user_opens_merge_request_spec.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'IDE merge request', :js do
|
||||
let(:merge_request) { create(:merge_request, :with_diffs, :simple, source_project: project) }
|
||||
let(:project) { create(:project, :public, :repository) }
|
||||
let(:user) { project.owner }
|
||||
|
||||
before do
|
||||
sign_in(user)
|
||||
|
||||
visit(merge_request_path(merge_request))
|
||||
end
|
||||
|
||||
it 'user opens merge request' do
|
||||
click_link 'Open in Web IDE'
|
||||
|
||||
wait_for_requests
|
||||
|
||||
expect(page).to have_selector('.monaco-diff-editor')
|
||||
end
|
||||
end
|
|
@ -32,6 +32,24 @@ describe('IDE store merge request mutations', () => {
|
|||
expect(newMr.title).toBe('mr');
|
||||
expect(newMr.active).toBeTruthy();
|
||||
});
|
||||
|
||||
it('keeps original data', () => {
|
||||
const versions = ['change'];
|
||||
const mergeRequest = localState.projects.abcproject.mergeRequests[1];
|
||||
|
||||
mergeRequest.versions = versions;
|
||||
|
||||
mutations.SET_MERGE_REQUEST(localState, {
|
||||
projectPath: 'abcproject',
|
||||
mergeRequestId: 1,
|
||||
mergeRequest: {
|
||||
title: ['change'],
|
||||
},
|
||||
});
|
||||
|
||||
expect(mergeRequest.title).toBe('mr');
|
||||
expect(mergeRequest.versions).toEqual(versions);
|
||||
});
|
||||
});
|
||||
|
||||
describe('SET_MERGE_REQUEST_CHANGES', () => {
|
||||
|
|
Loading…
Reference in a new issue