Commit 1918c2f0 authored by 🤖 GitLab Bot 🤖's avatar 🤖 GitLab Bot 🤖

Merge branch 'ce-to-ee-2018-12-11' into 'master'

CE upstream - 2018-12-11 12:21 UTC

Closes gitlab-ce#38524

See merge request gitlab-org/gitlab-ee!8789
parents f7348f91 0085f01a
......@@ -170,10 +170,14 @@ export default {
return expanded || this.alwaysExpanded || isResolvedNonDiffDiscussion;
},
actionText() {
const commitId = this.discussion.commit_id ? truncateSha(this.discussion.commit_id) : '';
const linkStart = `<a href="${_.escape(this.discussion.discussion_path)}">`;
const linkEnd = '</a>';
let { commit_id: commitId } = this.discussion;
if (commitId) {
commitId = `<span class="commit-sha">${truncateSha(commitId)}</span>`;
}
let text = s__('MergeRequests|started a discussion');
if (this.discussion.for_commit) {
......
......@@ -9,7 +9,7 @@ class Import::GithubController < Import::BaseController
rescue_from Octokit::Unauthorized, with: :provider_unauthorized
def new
if logged_in_with_provider?
if github_import_configured? && logged_in_with_provider?
go_to_provider_for_permissions
elsif session[access_token_key]
redirect_to status_import_url
......
---
title: Allow GitHub imports via token even if OAuth2 provider not configured
merge_request: 23703
author:
type: fixed
---
title: Make commit IDs in merge request discussion header monospace
merge_request: 23562
author:
type: changed
......@@ -16,6 +16,15 @@ describe Import::GithubController do
get :new
end
it "prompts for an access token if GitHub not configured" do
allow(controller).to receive(:github_import_configured?).and_return(false)
expect(controller).not_to receive(:go_to_provider_for_permissions)
get :new
expect(response).to have_http_status(200)
end
end
describe "GET callback" do
......
......@@ -42,12 +42,14 @@ describe('noteable_discussion component', () => {
const discussion = { ...discussionMock };
discussion.diff_file = mockDiffFile;
discussion.diff_discussion = true;
const diffDiscussionVm = new Component({
vm.$destroy();
vm = new Component({
store,
propsData: { discussion },
}).$mount();
expect(diffDiscussionVm.$el.querySelector('.discussion-header')).not.toBeNull();
expect(vm.$el.querySelector('.discussion-header')).not.toBeNull();
});
describe('actions', () => {
......@@ -130,4 +132,44 @@ describe('noteable_discussion component', () => {
expect(note).toEqual(data);
});
});
describe('commit discussion', () => {
const commitId = 'razupaltuff';
beforeEach(() => {
vm.$destroy();
store.state.diffs = {
projectPath: 'something',
};
vm.$destroy();
vm = new Component({
propsData: {
discussion: {
...discussionMock,
for_commit: true,
commit_id: commitId,
diff_discussion: true,
diff_file: {
...mockDiffFile,
},
},
renderDiffFile: true,
},
store,
}).$mount();
});
it('displays a monospace started a discussion on commit', () => {
const truncatedCommitId = commitId.substr(0, 8);
expect(vm.$el).toContainText(`started a discussion on commit ${truncatedCommitId}`);
const commitElement = vm.$el.querySelector('.commit-sha');
expect(commitElement).not.toBe(null);
expect(commitElement).toHaveText(truncatedCommitId);
});
});
});
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