Commit a8ab66c3 authored by Stan Hu's avatar Stan Hu

Merge branch 'ce-to-ee-2018-05-10' into 'master'

CE upstream - 2018-05-10 21:23 UTC

Closes gitlab-ce#39968

See merge request gitlab-org/gitlab-ee!5661
parents c1bf7fa7 04bfded0
...@@ -267,7 +267,7 @@ gem 'addressable', '~> 2.5.2' ...@@ -267,7 +267,7 @@ gem 'addressable', '~> 2.5.2'
gem 'bootstrap-sass', '~> 3.3.0' gem 'bootstrap-sass', '~> 3.3.0'
gem 'font-awesome-rails', '~> 4.7' gem 'font-awesome-rails', '~> 4.7'
gem 'gemojione', '~> 3.3' gem 'gemojione', '~> 3.3'
gem 'gon', '~> 6.1.0' gem 'gon', '~> 6.2'
gem 'jquery-atwho-rails', '~> 1.3.2' gem 'jquery-atwho-rails', '~> 1.3.2'
gem 'request_store', '~> 1.3' gem 'request_store', '~> 1.3'
gem 'select2-rails', '~> 3.5.9' gem 'select2-rails', '~> 3.5.9'
......
...@@ -357,9 +357,8 @@ GEM ...@@ -357,9 +357,8 @@ GEM
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
gollum-grit_adapter (1.0.1) gollum-grit_adapter (1.0.1)
gitlab-grit (~> 2.7, >= 2.7.1) gitlab-grit (~> 2.7, >= 2.7.1)
gon (6.1.0) gon (6.2.0)
actionpack (>= 3.0) actionpack (>= 3.0)
json
multi_json multi_json
request_store (>= 1.0) request_store (>= 1.0)
google-api-client (0.19.8) google-api-client (0.19.8)
...@@ -1100,7 +1099,7 @@ DEPENDENCIES ...@@ -1100,7 +1099,7 @@ DEPENDENCIES
gitlab-markup (~> 1.6.2) gitlab-markup (~> 1.6.2)
gitlab-styles (~> 2.3) gitlab-styles (~> 2.3)
gitlab_omniauth-ldap (~> 2.0.4) gitlab_omniauth-ldap (~> 2.0.4)
gon (~> 6.1.0) gon (~> 6.2)
google-api-client (~> 0.19.8) google-api-client (~> 0.19.8)
google-protobuf (= 3.5.1) google-protobuf (= 3.5.1)
gpgme gpgme
......
<script> <script>
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import { sprintf, __ } from '~/locale'; import { sprintf, __ } from '~/locale';
import * as consts from '../../stores/modules/commit/constants'; import * as consts from '../../stores/modules/commit/constants';
import RadioGroup from './radio_group.vue'; import RadioGroup from './radio_group.vue';
...@@ -10,6 +10,7 @@ export default { ...@@ -10,6 +10,7 @@ export default {
}, },
computed: { computed: {
...mapState(['currentBranchId', 'changedFiles', 'stagedFiles']), ...mapState(['currentBranchId', 'changedFiles', 'stagedFiles']),
...mapGetters(['currentProject']),
commitToCurrentBranchText() { commitToCurrentBranchText() {
return sprintf( return sprintf(
__('Commit to %{branchName} branch'), __('Commit to %{branchName} branch'),
...@@ -52,6 +53,7 @@ export default { ...@@ -52,6 +53,7 @@ export default {
:show-input="true" :show-input="true"
/> />
<radio-group <radio-group
v-if="currentProject.merge_requests_enabled"
:value="$options.commitToNewBranchMR" :value="$options.commitToNewBranchMR"
:label="__('Create a new branch and merge request')" :label="__('Create a new branch and merge request')"
:show-input="true" :show-input="true"
......
...@@ -110,8 +110,8 @@ export default { ...@@ -110,8 +110,8 @@ export default {
Welcome to the GitLab IDE Welcome to the GitLab IDE
</h4> </h4>
<p> <p>
You can select a file in the left sidebar to begin Select a file from the left sidebar to begin editing.
editing and use the right sidebar to commit your changes. Afterwards, you'll be able to commit your changes.
</p> </p>
</div> </div>
</div> </div>
......
...@@ -22,7 +22,8 @@ module ShaAttribute ...@@ -22,7 +22,8 @@ module ShaAttribute
column = columns.find { |c| c.name == name.to_s } column = columns.find { |c| c.name == name.to_s }
unless column unless column
raise ArgumentError.new("sha_attribute #{name.inspect} is invalid since the column doesn't exist") warn "WARNING: sha_attribute #{name.inspect} is invalid since the column doesn't exist - you may need to run database migrations"
return
end end
unless column.type == :binary unless column.type == :binary
......
...@@ -91,7 +91,7 @@ module Projects ...@@ -91,7 +91,7 @@ module Projects
new_path = removal_path(path) new_path = removal_path(path)
if mv_repository(path, new_path) if mv_repository(path, new_path)
log_info("Repository \"#{path}\" moved to \"#{new_path}\"") log_info(%Q{Repository "#{path}" moved to "#{new_path}" for project "#{project.full_path}"})
project.run_after_commit do project.run_after_commit do
# self is now project # self is now project
......
---
title: Fix finding wiki pages when they have invalidly-encoded content
merge_request: 18856
author:
type: fixed
---
title: Hide merge request option in IDE when disabled
merge_request:
author:
type: changed
---
title: Fix outdated Web IDE welcome copy
merge_request: 18861
author:
type: fixed
...@@ -7,6 +7,20 @@ module Gollum ...@@ -7,6 +7,20 @@ module Gollum
end end
require "gollum-lib" require "gollum-lib"
module Gollum
class Page
def text_data(encoding = nil)
data = if raw_data.respond_to?(:encoding)
raw_data.force_encoding(encoding || Encoding::UTF_8)
else
raw_data
end
Gitlab::EncodingHelper.encode!(data)
end
end
end
Rails.application.configure do Rails.application.configure do
config.after_initialize do config.after_initialize do
Gollum::Page.per_page = Kaminari.config.default_per_page Gollum::Page.per_page = Kaminari.config.default_per_page
......
...@@ -3,6 +3,7 @@ import store from '~/ide/stores'; ...@@ -3,6 +3,7 @@ import store from '~/ide/stores';
import commitActions from '~/ide/components/commit_sidebar/actions.vue'; import commitActions from '~/ide/components/commit_sidebar/actions.vue';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { resetStore } from 'spec/ide/helpers'; import { resetStore } from 'spec/ide/helpers';
import { projectData } from 'spec/ide/mock_data';
describe('IDE commit sidebar actions', () => { describe('IDE commit sidebar actions', () => {
let vm; let vm;
...@@ -13,6 +14,8 @@ describe('IDE commit sidebar actions', () => { ...@@ -13,6 +14,8 @@ describe('IDE commit sidebar actions', () => {
vm = createComponentWithStore(Component, store); vm = createComponentWithStore(Component, store);
vm.$store.state.currentBranchId = 'master'; vm.$store.state.currentBranchId = 'master';
vm.$store.state.currentProjectId = 'abcproject';
Vue.set(vm.$store.state.projects, 'abcproject', { ...projectData });
vm.$mount(); vm.$mount();
...@@ -32,4 +35,15 @@ describe('IDE commit sidebar actions', () => { ...@@ -32,4 +35,15 @@ describe('IDE commit sidebar actions', () => {
it('renders current branch text', () => { it('renders current branch text', () => {
expect(vm.$el.textContent).toContain('Commit to master branch'); expect(vm.$el.textContent).toContain('Commit to master branch');
}); });
it('hides merge request option when project merge requests are disabled', done => {
vm.$store.state.projects.abcproject.merge_requests_enabled = false;
vm.$nextTick(() => {
expect(vm.$el.querySelectorAll('input[type="radio"]').length).toBe(2);
expect(vm.$el.textContent).not.toContain('Create a new branch and merge request');
done();
});
});
}); });
...@@ -4,6 +4,7 @@ import CommitForm from '~/ide/components/commit_sidebar/form.vue'; ...@@ -4,6 +4,7 @@ import CommitForm from '~/ide/components/commit_sidebar/form.vue';
import { activityBarViews } from '~/ide/constants'; import { activityBarViews } from '~/ide/constants';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import getSetTimeoutPromise from 'spec/helpers/set_timeout_promise_helper'; import getSetTimeoutPromise from 'spec/helpers/set_timeout_promise_helper';
import { projectData } from 'spec/ide/mock_data';
import { resetStore } from '../../helpers'; import { resetStore } from '../../helpers';
describe('IDE commit form', () => { describe('IDE commit form', () => {
...@@ -14,6 +15,8 @@ describe('IDE commit form', () => { ...@@ -14,6 +15,8 @@ describe('IDE commit form', () => {
spyOnProperty(window, 'innerHeight').and.returnValue(800); spyOnProperty(window, 'innerHeight').and.returnValue(800);
store.state.changedFiles.push('test'); store.state.changedFiles.push('test');
store.state.currentProjectId = 'abcproject';
Vue.set(store.state.projects, 'abcproject', { ...projectData });
vm = createComponentWithStore(Component, store).$mount(); vm = createComponentWithStore(Component, store).$mount();
}); });
......
...@@ -12,4 +12,5 @@ export const projectData = { ...@@ -12,4 +12,5 @@ export const projectData = {
}, },
}, },
mergeRequests: {}, mergeRequests: {},
merge_requests_enabled: true,
}; };
...@@ -36,24 +36,26 @@ describe ShaAttribute do ...@@ -36,24 +36,26 @@ describe ShaAttribute do
end end
context 'when the table does not exist' do context 'when the table does not exist' do
it 'allows the attribute to be added' do it 'allows the attribute to be added and issues a warning' do
allow(model).to receive(:table_exists?).and_return(false) allow(model).to receive(:table_exists?).and_return(false)
expect(model).not_to receive(:columns) expect(model).not_to receive(:columns)
expect(model).to receive(:attribute) expect(model).to receive(:attribute)
expect(model).to receive(:warn)
model.sha_attribute(:name) model.sha_attribute(:name)
end end
end end
context 'when the column does not exist' do context 'when the column does not exist' do
it 'raises ArgumentError' do it 'allows the attribute to be added and issues a warning' do
allow(model).to receive(:table_exists?).and_return(true) allow(model).to receive(:table_exists?).and_return(true)
expect(model).to receive(:columns) expect(model).to receive(:columns)
expect(model).not_to receive(:attribute) expect(model).to receive(:attribute)
expect(model).to receive(:warn)
expect { model.sha_attribute(:no_name) }.to raise_error(ArgumentError) model.sha_attribute(:no_name)
end end
end end
......
...@@ -167,6 +167,17 @@ describe ProjectWiki do ...@@ -167,6 +167,17 @@ describe ProjectWiki do
expect(page.title).to eq("autre pagé") expect(page.title).to eq("autre pagé")
end end
end end
context 'pages with invalidly-encoded content' do
before do
create_page("encoding is fun", "f\xFCr".b)
end
it "can find the page" do
page = subject.find_page("encoding is fun")
expect(page.content).to eq("fr")
end
end
end end
context 'when Gitaly wiki_find_page is enabled' do context 'when Gitaly wiki_find_page is enabled' do
......
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