Commit fd633eed authored by Sean McGivern's avatar Sean McGivern

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

CE upstream - 2018-10-30 04:22 UTC

See merge request gitlab-org/gitlab-ee!8139
parents b09b82f1 a029c39b
...@@ -254,9 +254,6 @@ gem 'rack-attack', '~> 4.4.1' ...@@ -254,9 +254,6 @@ gem 'rack-attack', '~> 4.4.1'
# Ace editor # Ace editor
gem 'ace-rails-ap', '~> 4.1.0' gem 'ace-rails-ap', '~> 4.1.0'
# Keyboard shortcuts
gem 'mousetrap-rails', '~> 1.4.6'
# Detect and convert string character encoding # Detect and convert string character encoding
gem 'charlock_holmes', '~> 0.7.5' gem 'charlock_holmes', '~> 0.7.5'
......
...@@ -491,7 +491,6 @@ GEM ...@@ -491,7 +491,6 @@ GEM
mini_mime (1.0.1) mini_mime (1.0.1)
mini_portile2 (2.3.0) mini_portile2 (2.3.0)
minitest (5.7.0) minitest (5.7.0)
mousetrap-rails (1.4.6)
msgpack (1.2.4) msgpack (1.2.4)
multi_json (1.13.1) multi_json (1.13.1)
multi_xml (0.6.0) multi_xml (0.6.0)
...@@ -576,7 +575,7 @@ GEM ...@@ -576,7 +575,7 @@ GEM
orm_adapter (0.5.0) orm_adapter (0.5.0)
os (1.0.0) os (1.0.0)
parallel (1.12.1) parallel (1.12.1)
parser (2.5.1.2) parser (2.5.3.0)
ast (~> 2.4.0) ast (~> 2.4.0)
parslet (1.8.2) parslet (1.8.2)
peek (1.0.1) peek (1.0.1)
...@@ -1082,7 +1081,6 @@ DEPENDENCIES ...@@ -1082,7 +1081,6 @@ DEPENDENCIES
method_source (~> 0.8) method_source (~> 0.8)
mini_magick mini_magick
minitest (~> 5.7.0) minitest (~> 5.7.0)
mousetrap-rails (~> 1.4.6)
mysql2 (~> 0.4.10) mysql2 (~> 0.4.10)
net-ldap net-ldap
net-ntp net-ntp
......
...@@ -494,7 +494,6 @@ GEM ...@@ -494,7 +494,6 @@ GEM
mini_mime (1.0.1) mini_mime (1.0.1)
mini_portile2 (2.3.0) mini_portile2 (2.3.0)
minitest (5.7.0) minitest (5.7.0)
mousetrap-rails (1.4.6)
msgpack (1.2.4) msgpack (1.2.4)
multi_json (1.13.1) multi_json (1.13.1)
multi_xml (0.6.0) multi_xml (0.6.0)
...@@ -1091,7 +1090,6 @@ DEPENDENCIES ...@@ -1091,7 +1090,6 @@ DEPENDENCIES
method_source (~> 0.8) method_source (~> 0.8)
mini_magick mini_magick
minitest (~> 5.7.0) minitest (~> 5.7.0)
mousetrap-rails (~> 1.4.6)
mysql2 (~> 0.4.10) mysql2 (~> 0.4.10)
net-ldap net-ldap
net-ntp net-ntp
......
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { Button } from '@gitlab-org/gitlab-ui'; import { GlButton } from '@gitlab-org/gitlab-ui';
import eventHub from '../eventhub'; import eventHub from '../eventhub';
import ProjectSelect from './project_select.vue'; import ProjectSelect from './project_select.vue';
import ListIssue from '../models/issue'; import ListIssue from '../models/issue';
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
name: 'BoardNewIssue', name: 'BoardNewIssue',
components: { components: {
ProjectSelect, ProjectSelect,
'gl-button': Button, GlButton,
}, },
props: { props: {
groupId: { groupId: {
......
<script> <script>
import { Link } from '@gitlab-org/gitlab-ui'; import { GlLink } from '@gitlab-org/gitlab-ui';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import ModalStore from '../../stores/modal_store'; import ModalStore from '../../stores/modal_store';
import boardsStore from '../../stores/boards_store'; import boardsStore from '../../stores/boards_store';
export default { export default {
components: { components: {
'gl-link': Link, GlLink,
Icon, Icon,
}, },
data() { data() {
......
import Vue from 'vue'; import Vue from 'vue';
import { import {
Pagination, GlPagination,
ProgressBar, GlProgressBar,
Modal, GlModal,
LoadingIcon, GlLoadingIcon,
ModalDirective, GlModalDirective,
TooltipDirective, GlTooltipDirective,
} from '@gitlab-org/gitlab-ui'; } from '@gitlab-org/gitlab-ui';
Vue.component('gl-pagination', Pagination); Vue.component('gl-pagination', GlPagination);
Vue.component('gl-progress-bar', ProgressBar); Vue.component('gl-progress-bar', GlProgressBar);
Vue.component('gl-ui-modal', Modal); Vue.component('gl-ui-modal', GlModal);
Vue.component('gl-loading-icon', LoadingIcon); Vue.component('gl-loading-icon', GlLoadingIcon);
Vue.directive('gl-modal', ModalDirective); Vue.directive('gl-modal', GlModalDirective);
Vue.directive('gl-tooltip', TooltipDirective); Vue.directive('gl-tooltip', GlTooltipDirective);
...@@ -40,17 +40,14 @@ export default { ...@@ -40,17 +40,14 @@ export default {
comparableDiffs() { comparableDiffs() {
return this.mergeRequestDiffs.slice(1); return this.mergeRequestDiffs.slice(1);
}, },
isWhitespaceVisible() {
return !getParameterValues('w')[0];
},
toggleWhitespaceText() { toggleWhitespaceText() {
if (this.isWhitespaceVisible) { if (this.isWhitespaceVisible()) {
return __('Hide whitespace changes'); return __('Hide whitespace changes');
} }
return __('Show whitespace changes'); return __('Show whitespace changes');
}, },
toggleWhitespacePath() { toggleWhitespacePath() {
if (this.isWhitespaceVisible) { if (this.isWhitespaceVisible()) {
return mergeUrlParams({ w: 1 }, window.location.href); return mergeUrlParams({ w: 1 }, window.location.href);
} }
...@@ -67,6 +64,9 @@ export default { ...@@ -67,6 +64,9 @@ export default {
'expandAllFiles', 'expandAllFiles',
'toggleShowTreeList', 'toggleShowTreeList',
]), ]),
isWhitespaceVisible() {
return getParameterValues('w')[0] !== '1';
},
}, },
}; };
</script> </script>
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
</a> </a>
<a <a
:href="toggleWhitespacePath" :href="toggleWhitespacePath"
class="btn btn-default" class="btn btn-default qa-toggle-whitespace"
> >
{{ toggleWhitespaceText }} {{ toggleWhitespaceText }}
</a> </a>
......
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { TooltipDirective as Tooltip } from '@gitlab-org/gitlab-ui'; import { GlTooltipDirective } from '@gitlab-org/gitlab-ui';
import { convertPermissionToBoolean } from '~/lib/utils/common_utils'; import { convertPermissionToBoolean } from '~/lib/utils/common_utils';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import FileRow from '~/vue_shared/components/file_row.vue'; import FileRow from '~/vue_shared/components/file_row.vue';
...@@ -10,7 +10,7 @@ const treeListStorageKey = 'mr_diff_tree_list'; ...@@ -10,7 +10,7 @@ const treeListStorageKey = 'mr_diff_tree_list';
export default { export default {
directives: { directives: {
Tooltip, GlTooltip: GlTooltipDirective,
}, },
components: { components: {
Icon, Icon,
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
class="btn-group prepend-left-8 tree-list-view-toggle" class="btn-group prepend-left-8 tree-list-view-toggle"
> >
<button <button
v-tooltip.hover v-gl-tooltip.hover
:aria-label="__('List view')" :aria-label="__('List view')"
:title="__('List view')" :title="__('List view')"
:class="{ :class="{
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
/> />
</button> </button>
<button <button
v-tooltip.hover v-gl-tooltip.hover
:aria-label="__('Tree view')" :aria-label="__('Tree view')"
:title="__('Tree view')" :title="__('Tree view')"
:class="{ :class="{
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
/** /**
* Renders the Monitoring (Metrics) link in environments table. * Renders the Monitoring (Metrics) link in environments table.
*/ */
import { Button } from '@gitlab-org/gitlab-ui'; import { GlButton } from '@gitlab-org/gitlab-ui';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import tooltip from '../../vue_shared/directives/tooltip'; import tooltip from '../../vue_shared/directives/tooltip';
export default { export default {
components: { components: {
Icon, Icon,
'gl-button': Button, GlButton,
}, },
directives: { directives: {
tooltip, tooltip,
......
<script> <script>
import { mapState, mapGetters } from 'vuex'; import { mapState, mapGetters } from 'vuex';
import { SkeletonLoading } from '@gitlab-org/gitlab-ui'; import { GlSkeletonLoading } from '@gitlab-org/gitlab-ui';
import IdeTree from './ide_tree.vue'; import IdeTree from './ide_tree.vue';
import ResizablePanel from './resizable_panel.vue'; import ResizablePanel from './resizable_panel.vue';
import ActivityBar from './activity_bar.vue'; import ActivityBar from './activity_bar.vue';
...@@ -13,7 +13,7 @@ import { activityBarViews } from '../constants'; ...@@ -13,7 +13,7 @@ import { activityBarViews } from '../constants';
export default { export default {
components: { components: {
SkeletonLoading, GlSkeletonLoading,
ResizablePanel, ResizablePanel,
ActivityBar, ActivityBar,
CommitSection, CommitSection,
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
:key="n" :key="n"
class="multi-file-loading-container" class="multi-file-loading-container"
> >
<skeleton-loading /> <gl-skeleton-loading />
</div> </div>
</div> </div>
</template> </template>
......
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import { SkeletonLoading } from '@gitlab-org/gitlab-ui'; import { GlSkeletonLoading } from '@gitlab-org/gitlab-ui';
import FileRow from '~/vue_shared/components/file_row.vue'; import FileRow from '~/vue_shared/components/file_row.vue';
import NavDropdown from './nav_dropdown.vue'; import NavDropdown from './nav_dropdown.vue';
import FileRowExtra from './file_row_extra.vue'; import FileRowExtra from './file_row_extra.vue';
...@@ -9,7 +9,7 @@ import FileRowExtra from './file_row_extra.vue'; ...@@ -9,7 +9,7 @@ import FileRowExtra from './file_row_extra.vue';
export default { export default {
components: { components: {
Icon, Icon,
SkeletonLoading, GlSkeletonLoading,
NavDropdown, NavDropdown,
FileRow, FileRow,
}, },
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
:key="n" :key="n"
class="multi-file-loading-container" class="multi-file-loading-container"
> >
<skeleton-loading /> <gl-skeleton-loading />
</div> </div>
</template> </template>
<template v-else> <template v-else>
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
...mapState('pipelines', ['isLoadingPipeline', 'latestPipeline', 'stages', 'isLoadingJobs']), ...mapState('pipelines', ['isLoadingPipeline', 'latestPipeline', 'stages', 'isLoadingJobs']),
ciLintText() { ciLintText() {
return sprintf( return sprintf(
__('You can also test your .gitlab-ci.yml in the %{linkStart}Lint%{linkEnd}'), __('You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}.'),
{ {
linkStart: `<a href="${_.escape(this.currentProject.web_url)}/-/ci/lint">`, linkStart: `<a href="${_.escape(this.currentProject.web_url)}/-/ci/lint">`,
linkEnd: '</a>', linkEnd: '</a>',
......
...@@ -16,7 +16,7 @@ import 'vendor/jquery.atwho'; ...@@ -16,7 +16,7 @@ import 'vendor/jquery.atwho';
import AjaxCache from '~/lib/utils/ajax_cache'; import AjaxCache from '~/lib/utils/ajax_cache';
import Vue from 'vue'; import Vue from 'vue';
import syntaxHighlight from '~/syntax_highlight'; import syntaxHighlight from '~/syntax_highlight';
import { SkeletonLoading } from '@gitlab-org/gitlab-ui'; import { GlSkeletonLoading } from '@gitlab-org/gitlab-ui';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import { getLocationHash } from './lib/utils/url_utility'; import { getLocationHash } from './lib/utils/url_utility';
import Flash from './flash'; import Flash from './flash';
...@@ -1293,10 +1293,10 @@ export default class Notes { ...@@ -1293,10 +1293,10 @@ export default class Notes {
new Vue({ new Vue({
el, el,
components: { components: {
SkeletonLoading, GlSkeletonLoading,
}, },
render(createElement) { render(createElement) {
return createElement('skeleton-loading'); return createElement('gl-skeleton-loading');
}, },
}); });
} }
......
...@@ -3,13 +3,13 @@ import { mapState, mapActions } from 'vuex'; ...@@ -3,13 +3,13 @@ import { mapState, mapActions } from 'vuex';
import imageDiffHelper from '~/image_diff/helpers/index'; import imageDiffHelper from '~/image_diff/helpers/index';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import DiffFileHeader from '~/diffs/components/diff_file_header.vue'; import DiffFileHeader from '~/diffs/components/diff_file_header.vue';
import { SkeletonLoading } from '@gitlab-org/gitlab-ui'; import { GlSkeletonLoading } from '@gitlab-org/gitlab-ui';
import { trimFirstCharOfLineContent } from '~/diffs/store/utils'; import { trimFirstCharOfLineContent } from '~/diffs/store/utils';
export default { export default {
components: { components: {
DiffFileHeader, DiffFileHeader,
SkeletonLoading, GlSkeletonLoading,
}, },
props: { props: {
discussion: { discussion: {
...@@ -143,7 +143,7 @@ export default { ...@@ -143,7 +143,7 @@ export default {
class="line_content js-success-lazy-load" class="line_content js-success-lazy-load"
> >
<span></span> <span></span>
<skeleton-loading /> <gl-skeleton-loading />
<span></span> <span></span>
</td> </td>
</tr> </tr>
......
<script> <script>
import { Link } from '@gitlab-org/gitlab-ui'; import { GlLink } from '@gitlab-org/gitlab-ui';
import Icon from '../../icon.vue'; import Icon from '../../icon.vue';
import { numberToHumanSize } from '../../../../lib/utils/number_utils'; import { numberToHumanSize } from '../../../../lib/utils/number_utils';
export default { export default {
components: { components: {
'gl-link': Link, GlLink,
Icon, Icon,
}, },
props: { props: {
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import $ from 'jquery'; import $ from 'jquery';
import { SkeletonLoading } from '@gitlab-org/gitlab-ui'; import { GlSkeletonLoading } from '@gitlab-org/gitlab-ui';
const { CancelToken } = axios; const { CancelToken } = axios;
let axiosSource; let axiosSource;
export default { export default {
components: { components: {
SkeletonLoading, GlSkeletonLoading,
}, },
props: { props: {
content: { content: {
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
<div <div
ref="markdown-preview" ref="markdown-preview"
class="md md-previewer"> class="md md-previewer">
<skeleton-loading v-if="isLoading" /> <gl-skeleton-loading v-if="isLoading" />
<div <div
v-else v-else
v-html="previewContent"> v-html="previewContent">
......
<script> <script>
import { Link } from '@gitlab-org/gitlab-ui'; import { GlLink } from '@gitlab-org/gitlab-ui';
export default { export default {
components: { components: {
'gl-link': Link, GlLink,
}, },
props: { props: {
markdownDocsPath: { markdownDocsPath: {
......
<script> <script>
import { SkeletonLoading } from '@gitlab-org/gitlab-ui'; import { GlSkeletonLoading } from '@gitlab-org/gitlab-ui';
export default { export default {
name: 'SkeletonNote', name: 'SkeletonNote',
components: { components: {
SkeletonLoading, GlSkeletonLoading,
}, },
}; };
</script> </script>
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
<div class="timeline-content"> <div class="timeline-content">
<div class="note-header"></div> <div class="note-header"></div>
<div class="note-body"> <div class="note-body">
<skeleton-loading /> <gl-skeleton-loading />
</div> </div>
</div> </div>
</div> </div>
......
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
*/ */
import { Link } from '@gitlab-org/gitlab-ui'; import { GlLink } from '@gitlab-org/gitlab-ui';
import userAvatarImage from './user_avatar_image.vue'; import userAvatarImage from './user_avatar_image.vue';
import tooltip from '../../directives/tooltip'; import tooltip from '../../directives/tooltip';
export default { export default {
name: 'UserAvatarLink', name: 'UserAvatarLink',
components: { components: {
'gl-link': Link, GlLink,
userAvatarImage, userAvatarImage,
}, },
directives: { directives: {
......
...@@ -86,10 +86,10 @@ module CreatesCommit ...@@ -86,10 +86,10 @@ module CreatesCommit
def new_merge_request_path def new_merge_request_path
project_new_merge_request_path( project_new_merge_request_path(
@project_to_commit_into, @project_to_commit_into,
merge_request_source_branch: @branch_name,
merge_request: { merge_request: {
source_project_id: @project_to_commit_into.id, source_project_id: @project_to_commit_into.id,
target_project_id: @project.id, target_project_id: @project.id,
source_branch: @branch_name,
target_branch: @start_branch target_branch: @start_branch
} }
) )
......
...@@ -89,6 +89,8 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap ...@@ -89,6 +89,8 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
def build_merge_request def build_merge_request
params[:merge_request] ||= ActionController::Parameters.new(source_project: @project) params[:merge_request] ||= ActionController::Parameters.new(source_project: @project)
params[:merge_request][:source_branch] ||= params[:merge_request_source_branch].presence
@merge_request = ::MergeRequests::BuildService.new(project, current_user, merge_request_params.merge(diff_options: diff_options)).execute @merge_request = ::MergeRequests::BuildService.new(project, current_user, merge_request_params.merge(diff_options: diff_options)).execute
end end
......
...@@ -13,8 +13,8 @@ module CompareHelper ...@@ -13,8 +13,8 @@ module CompareHelper
def create_mr_path(from = params[:from], to = params[:to], project = @project) def create_mr_path(from = params[:from], to = params[:to], project = @project)
project_new_merge_request_path( project_new_merge_request_path(
project, project,
merge_request_source_branch: to,
merge_request: { merge_request: {
source_branch: to,
target_branch: from target_branch: from
} }
) )
......
...@@ -13,10 +13,10 @@ module MergeRequestsHelper ...@@ -13,10 +13,10 @@ module MergeRequestsHelper
def new_mr_from_push_event(event, target_project) def new_mr_from_push_event(event, target_project)
{ {
merge_request_source_branch: event.branch_name,
merge_request: { merge_request: {
source_project_id: event.project.id, source_project_id: event.project.id,
target_project_id: target_project.id, target_project_id: target_project.id,
source_branch: event.branch_name,
target_branch: target_project.repository.root_ref target_branch: target_project.repository.root_ref
} }
} }
...@@ -53,10 +53,10 @@ module MergeRequestsHelper ...@@ -53,10 +53,10 @@ module MergeRequestsHelper
def mr_change_branches_path(merge_request) def mr_change_branches_path(merge_request)
project_new_merge_request_path( project_new_merge_request_path(
@project, @project,
merge_request_source_branch: merge_request.source_branch,
merge_request: { merge_request: {
source_project_id: merge_request.source_project_id, source_project_id: merge_request.source_project_id,
target_project_id: merge_request.target_project_id, target_project_id: merge_request.target_project_id,
source_branch: merge_request.source_branch,
target_branch: merge_request.target_branch target_branch: merge_request.target_branch
}, },
change_branches: true change_branches: true
......
...@@ -149,7 +149,7 @@ class Milestone < ActiveRecord::Base ...@@ -149,7 +149,7 @@ class Milestone < ActiveRecord::Base
end end
def participants def participants
User.joins(assigned_issues: :milestone).where("milestones.id = ?", id).uniq User.joins(assigned_issues: :milestone).where("milestones.id = ?", id).distinct
end end
def self.sort_by_attribute(method) def self.sort_by_attribute(method)
......
...@@ -1160,7 +1160,7 @@ class User < ActiveRecord::Base ...@@ -1160,7 +1160,7 @@ class User < ActiveRecord::Base
events = Event.select(:project_id) events = Event.select(:project_id)
.contributions.where(author_id: self) .contributions.where(author_id: self)
.where("created_at > ?", Time.now - 1.year) .where("created_at > ?", Time.now - 1.year)
.uniq .distinct
.reorder(nil) .reorder(nil)
Project.where(id: events) Project.where(id: events)
......
...@@ -24,8 +24,8 @@ class DeleteMergedBranchesService < BaseService ...@@ -24,8 +24,8 @@ class DeleteMergedBranchesService < BaseService
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def merge_request_branch_names def merge_request_branch_names
# reorder(nil) is necessary for SELECT DISTINCT because default scope adds an ORDER BY # reorder(nil) is necessary for SELECT DISTINCT because default scope adds an ORDER BY
source_names = project.origin_merge_requests.opened.reorder(nil).uniq.pluck(:source_branch) source_names = project.origin_merge_requests.opened.reorder(nil).distinct.pluck(:source_branch)
target_names = project.merge_requests.opened.reorder(nil).uniq.pluck(:target_branch) target_names = project.merge_requests.opened.reorder(nil).distinct.pluck(:target_branch)
(source_names + target_names).uniq (source_names + target_names).uniq
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
...@@ -40,7 +40,7 @@ module Labels ...@@ -40,7 +40,7 @@ module Labels
group_labels_applied_to_merge_requests group_labels_applied_to_merge_requests
]) ])
.reorder(nil) .reorder(nil)
.uniq .distinct
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
...@@ -50,8 +50,8 @@ module MergeRequests ...@@ -50,8 +50,8 @@ module MergeRequests
end end
def url_for_new_merge_request(branch_name) def url_for_new_merge_request(branch_name)
merge_request_params = { source_branch: branch_name } url = Gitlab::Routing.url_helpers.project_new_merge_request_url(project, branch_name)
url = Gitlab::Routing.url_helpers.project_new_merge_request_url(project, merge_request: merge_request_params)
{ branch_name: branch_name, url: url, new_merge_request: true } { branch_name: branch_name, url: url, new_merge_request: true }
end end
......
...@@ -19,30 +19,23 @@ ...@@ -19,30 +19,23 @@
#js-pipeline-graph-vue #js-pipeline-graph-vue
#js-tab-builds.tab-pane #js-tab-builds.tab-pane
- if pipeline.yaml_errors.present? - if pipeline.legacy_stages.present?
.bs-callout.bs-callout-danger .table-holder.pipeline-holder
%h4 Found errors in your .gitlab-ci.yml: %table.table.ci-table.pipeline
%ul %thead
- pipeline.yaml_errors.split(",").each do |error| %tr
%li= error %th Status
You can also test your .gitlab-ci.yml in the #{link_to "Lint", project_ci_lint_path(@project)} %th Job ID
%th Name
%th
%th Coverage
%th
= render partial: "projects/stage/stage", collection: pipeline.legacy_stages, as: :stage
- if pipeline.project.builds_enabled? && !pipeline.ci_yaml_file - elsif pipeline.project.builds_enabled? && !pipeline.ci_yaml_file
.bs-callout.bs-callout-warning .bs-callout.bs-callout-warning
\.gitlab-ci.yml not found in this commit \.gitlab-ci.yml not found in this commit
.table-holder.pipeline-holder
%table.table.ci-table.pipeline
%thead
%tr
%th Status
%th Job ID
%th Name
%th
%th Coverage
%th
= render partial: "projects/stage/stage", collection: pipeline.legacy_stages, as: :stage
- if @pipeline.failed_builds.present? - if @pipeline.failed_builds.present?
#js-tab-failures.build-failures.tab-pane.build-page #js-tab-failures.build-failures.tab-pane.build-page
%table.table.responsive-table.ci-table.responsive-table-sm-rounded %table.table.responsive-table.ci-table.responsive-table-sm-rounded
......
...@@ -9,6 +9,14 @@ ...@@ -9,6 +9,14 @@
- if @pipeline.commit.present? - if @pipeline.commit.present?
= render "projects/pipelines/info", commit: @pipeline.commit = render "projects/pipelines/info", commit: @pipeline.commit
= render "projects/pipelines/with_tabs", pipeline: @pipeline - if @pipeline.builds.empty? && @pipeline.yaml_errors.present?
.bs-callout.bs-callout-danger
%h4 Found errors in your .gitlab-ci.yml:
%ul
- @pipeline.yaml_errors.split(",").each do |error|
%li= error
You can test your .gitlab-ci.yml in #{link_to "CI Lint", project_ci_lint_path(@project)}.
- else
= render "projects/pipelines/with_tabs", pipeline: @pipeline
.js-pipeline-details-vue{ data: { endpoint: project_pipeline_path(@project, @pipeline, format: :json) } } .js-pipeline-details-vue{ data: { endpoint: project_pipeline_path(@project, @pipeline, format: :json) } }
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
.block.milestone .block.milestone
.sidebar-collapsed-icon.has-tooltip{ title: milestone_tooltip_title(issuable.milestone), data: { container: 'body', html: 'true', placement: 'left', boundary: 'viewport' } } .sidebar-collapsed-icon.has-tooltip{ title: milestone_tooltip_title(issuable.milestone), data: { container: 'body', html: 'true', placement: 'left', boundary: 'viewport' } }
= icon('clock-o', 'aria-hidden': 'true') = icon('clock-o', 'aria-hidden': 'true')
%span.milestone-title %span.milestone-title.collapse-truncated-title
- if issuable.milestone - if issuable.milestone
= issuable.milestone.title = issuable.milestone.title
- else - else
......
---
title: Hide all tables on Pipeline when no Jobs for the Pipeline
merge_request: 18540
author: Takuya Noguchi
type: fixed
---
title: Fix broken "Show whitespace changes" button on MRs.
merge_request: 22539
author:
type: fixed
---
title: Use key-value pair arrays for API query parameter logging instead of hashes
merge_request: 22623
author:
type: other
---
title: Remove mousetrap-rails gem
merge_request: 22647
author: Takuya Noguchi
type: other
---
title: Update moment to 2.22.2
merge_request: 22648
author: Takuya Noguchi
type: security
---
title: Make new merge request URL more friendly when pushing code
merge_request: 22526
author: "@blackst0ne"
type: changed
---
title: Truncate milestone title on collapsed sidebar
merge_request: 22624
author: George Tsiolis
type: changed
---
title: Replace deprecated uniq on a Relation with distinct
merge_request: 22625
author: Jasper Maes
type: other
...@@ -181,9 +181,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -181,9 +181,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
scope path: 'merge_requests', controller: 'merge_requests/creations' do scope path: 'merge_requests', controller: 'merge_requests/creations' do
post '', action: :create, as: nil post '', action: :create, as: nil
scope path: 'new', as: :new_merge_request do scope path: 'new/(:merge_request_source_branch)', as: :new_merge_request do
get '', action: :new
scope constraints: { format: nil }, action: :new do scope constraints: { format: nil }, action: :new do
get :diffs, defaults: { tab: 'diffs' } get :diffs, defaults: { tab: 'diffs' }
get :pipelines, defaults: { tab: 'pipelines' } get :pipelines, defaults: { tab: 'pipelines' }
...@@ -197,6 +195,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -197,6 +195,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :diff_for_path get :diff_for_path
get :branch_from get :branch_from
get :branch_to get :branch_to
get '', action: :new
end end
end end
......
...@@ -61,7 +61,7 @@ on an Linux NFS server, do the following: ...@@ -61,7 +61,7 @@ on an Linux NFS server, do the following:
2. Restart the NFS server process. For example, on CentOS run `service nfs restart`. 2. Restart the NFS server process. For example, on CentOS run `service nfs restart`.
## AWS Elastic File System ## Avoid using AWS's Elastic File System (EFS)
GitLab strongly recommends against using AWS Elastic File System (EFS). GitLab strongly recommends against using AWS Elastic File System (EFS).
Our support team will not be able to assist on performance issues related to Our support team will not be able to assist on performance issues related to
...@@ -78,6 +78,23 @@ stored on a local volume. ...@@ -78,6 +78,23 @@ stored on a local volume.
For more details on another person's experience with EFS, see For more details on another person's experience with EFS, see
[Amazon's Elastic File System: Burst Credits](https://rawkode.com/2017/04/16/amazons-elastic-file-system-burst-credits/) [Amazon's Elastic File System: Burst Credits](https://rawkode.com/2017/04/16/amazons-elastic-file-system-burst-credits/)
## Avoid using PostgreSQL with NFS
GitLab strongly recommends against running your PostgreSQL database
across NFS. The GitLab support team will not be able to assist on performance issues related to
this configuration.
Additionally, this configuration is specifically warned against in the
[Postgres Documentation](https://www.postgresql.org/docs/current/static/creating-cluster.html#CREATING-CLUSTER-NFS):
>PostgreSQL does nothing special for NFS file systems, meaning it assumes NFS behaves exactly like
>locally-connected drives. If the client or server NFS implementation does not provide standard file
>system semantics, this can cause reliability problems. Specifically, delayed (asynchronous) writes
>to the NFS server can cause data corruption problems.
For supported database architecture, please see our documentation on
[Configuring a Database for GitLab HA](https://docs.gitlab.com/ee/administration/high_availability/database.html).
## NFS Client mount options ## NFS Client mount options
Below is an example of an NFS mount point defined in `/etc/fstab` we use on Below is an example of an NFS mount point defined in `/etc/fstab` we use on
......
...@@ -84,7 +84,7 @@ Introduced in GitLab 10.0, this file lives in ...@@ -84,7 +84,7 @@ Introduced in GitLab 10.0, this file lives in
It helps you see requests made directly to the API. For example: It helps you see requests made directly to the API. For example:
```json ```json
{"time":"2017-10-10T12:30:11.579Z","severity":"INFO","duration":16.84,"db":1.57,"view":15.27,"status":200,"method":"POST","path":"/api/v4/internal/allowed","params":{"action":"git-upload-pack","changes":"_any","gl_repository":null,"project":"root/foobar.git","protocol":"ssh","env":"{}","key_id":"[FILTERED]","secret_token":"[FILTERED]"},"host":"127.0.0.1","ip":"127.0.0.1","ua":"Ruby"} {"time":"2018-10-29T12:49:42.123Z","severity":"INFO","duration":709.08,"db":14.59,"view":694.49,"status":200,"method":"GET","path":"/api/v4/projects","params":[{"key":"action","value":"git-upload-pack"},{"key":"changes","value":"_any"},{"key":"key_id","value":"secret"},{"key":"secret_token","value":"[FILTERED]"}],"host":"localhost","ip":"::1","ua":"Ruby","route":"/api/:version/projects","user_id":1,"username":"root","queue_duration":100.31,"gitaly_calls":30}
``` ```
This entry above shows an access to an internal endpoint to check whether an This entry above shows an access to an internal endpoint to check whether an
......
...@@ -83,6 +83,9 @@ under which this application will be deployed. ...@@ -83,6 +83,9 @@ under which this application will be deployed.
![GitLab GKE cluster details](img/guide_gitlab_gke_details.png) ![GitLab GKE cluster details](img/guide_gitlab_gke_details.png)
1. Once ready, click **Create Kubernetes cluster**. 1. Once ready, click **Create Kubernetes cluster**.
NOTE: **Note:**
Do not select `f1-micro` from the **Machine type** dropdown. `f1-micro` machines cannot support a full GitLab installation.
After a couple of minutes, the cluster will be created. You can also see its After a couple of minutes, the cluster will be created. You can also see its
status on your [GCP dashboard](https://console.cloud.google.com/kubernetes). status on your [GCP dashboard](https://console.cloud.google.com/kubernetes).
......
<script> <script>
import { SkeletonLoading } from '@gitlab-org/gitlab-ui'; import { GlSkeletonLoading } from '@gitlab-org/gitlab-ui';
import SeverityBadge from 'ee/vue_shared/security_reports/components/severity_badge.vue'; import SeverityBadge from 'ee/vue_shared/security_reports/components/severity_badge.vue';
import SecurityDashboardActionButtons from './security_dashboard_action_buttons.vue'; import SecurityDashboardActionButtons from './security_dashboard_action_buttons.vue';
import VulnerabilityIssueLink from './vulnerability_issue_link.vue'; import VulnerabilityIssueLink from './vulnerability_issue_link.vue';
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
components: { components: {
SeverityBadge, SeverityBadge,
SecurityDashboardActionButtons, SecurityDashboardActionButtons,
SkeletonLoading, GlSkeletonLoading,
VulnerabilityIssueLink, VulnerabilityIssueLink,
}, },
props: { props: {
...@@ -67,7 +67,7 @@ export default { ...@@ -67,7 +67,7 @@ export default {
{{ s__('Reports|Vulnerability') }} {{ s__('Reports|Vulnerability') }}
</div> </div>
<div class="table-mobile-content"> <div class="table-mobile-content">
<skeleton-loading <gl-skeleton-loading
v-if="isLoading" v-if="isLoading"
class="mt-2 js-skeleton-loader" class="mt-2 js-skeleton-loader"
:lines="2" :lines="2"
......
<script> <script>
import { Button } from '@gitlab-org/gitlab-ui'; import { GlButton } from '@gitlab-org/gitlab-ui';
import { LICENSE_APPROVAL_STATUS } from '../constants'; import { LICENSE_APPROVAL_STATUS } from '../constants';
import AddLicenseFormDropdown from './add_license_form_dropdown.vue'; import AddLicenseFormDropdown from './add_license_form_dropdown.vue';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
name: 'AddLicenseForm', name: 'AddLicenseForm',
components: { components: {
AddLicenseFormDropdown, AddLicenseFormDropdown,
glButton: Button, GlButton,
}, },
LICENSE_APPROVAL_STATUS, LICENSE_APPROVAL_STATUS,
approvalStatusOptions: [ approvalStatusOptions: [
......
<script> <script>
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { Button } from '@gitlab-org/gitlab-ui'; import { GlButton } from '@gitlab-org/gitlab-ui';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import AddLicenseForm from './components/add_license_form.vue'; import AddLicenseForm from './components/add_license_form.vue';
import LicenseManagementRow from './components/license_management_row.vue'; import LicenseManagementRow from './components/license_management_row.vue';
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
AddLicenseForm, AddLicenseForm,
DeleteConfirmationModal, DeleteConfirmationModal,
LicenseManagementRow, LicenseManagementRow,
glButton: Button, GlButton,
}, },
props: { props: {
apiUrl: { apiUrl: {
......
...@@ -73,7 +73,7 @@ module Gitlab ...@@ -73,7 +73,7 @@ module Gitlab
# re-running the contributed projects query in each union is expensive, so # re-running the contributed projects query in each union is expensive, so
# use IN(project_ids...) instead. It's the intersection of two users so # use IN(project_ids...) instead. It's the intersection of two users so
# the list will be (relatively) short # the list will be (relatively) short
@contributed_project_ids ||= projects.uniq.pluck(:id) @contributed_project_ids ||= projects.distinct.pluck(:id)
authed_projects = Project.where(id: @contributed_project_ids) authed_projects = Project.where(id: @contributed_project_ids)
.with_feature_available_for_user(feature, current_user) .with_feature_available_for_user(feature, current_user)
.reorder(nil) .reorder(nil)
......
...@@ -6,7 +6,7 @@ module Gitlab ...@@ -6,7 +6,7 @@ module Gitlab
def call(severity, datetime, _, data) def call(severity, datetime, _, data)
time = data.delete :time time = data.delete :time
data[:params] = utf8_encode_values(data[:params]) if data.has_key?(:params) data[:params] = process_params(data)
attributes = { attributes = {
time: datetime.utc.iso8601(3), time: datetime.utc.iso8601(3),
...@@ -20,6 +20,14 @@ module Gitlab ...@@ -20,6 +20,14 @@ module Gitlab
private private
def process_params(data)
return [] unless data.has_key?(:params)
data[:params]
.each_pair
.map { |k, v| { key: k, value: utf8_encode_values(v) } }
end
def utf8_encode_values(data) def utf8_encode_values(data)
case data case data
when Hash when Hash
......
...@@ -8841,9 +8841,6 @@ msgstr "" ...@@ -8841,9 +8841,6 @@ msgstr ""
msgid "You can also star a label to make it a priority label." msgid "You can also star a label to make it a priority label."
msgstr "" msgstr ""
msgid "You can also test your .gitlab-ci.yml in the %{linkStart}Lint%{linkEnd}"
msgstr ""
msgid "You can easily contribute to them by requesting to join these groups." msgid "You can easily contribute to them by requesting to join these groups."
msgstr "" msgstr ""
...@@ -8865,6 +8862,9 @@ msgstr "" ...@@ -8865,6 +8862,9 @@ msgstr ""
msgid "You can set up jobs to only use Runners with specific tags. Separate tags with commas." msgid "You can set up jobs to only use Runners with specific tags. Separate tags with commas."
msgstr "" msgstr ""
msgid "You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}."
msgstr ""
msgid "You cannot write to a read-only secondary GitLab Geo instance. Please use %{link_to_primary_node} instead." msgid "You cannot write to a read-only secondary GitLab Geo instance. Please use %{link_to_primary_node} instead."
msgstr "" msgstr ""
......
...@@ -47,7 +47,7 @@ module QA ...@@ -47,7 +47,7 @@ module QA
repository.use_ssh_key(ssh_key) repository.use_ssh_key(ssh_key)
else else
repository.uri = repository_http_uri repository.uri = repository_http_uri
repository.use_default_credentials repository.use_default_credentials unless user
end end
username = 'GitLab QA' username = 'GitLab QA'
......
# frozen_string_literal: true
module QA
context 'Create' do
describe 'Git push over HTTP', :ldap_no_tls do
it 'user using a personal access token pushes code to the repository' do
Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials)
access_token = Factory::Resource::PersonalAccessToken.fabricate!.access_token
user = Factory::Resource::User.new.tap do |user|
user.username = Runtime::User.username
user.password = access_token
end
push = Factory::Repository::ProjectPush.fabricate! do |push|
push.user = user
push.file_name = 'README.md'
push.file_content = '# This is a test project'
push.commit_message = 'Add README.md'
end
push.project.visit!
Page::Project::Show.perform(&:wait_for_push)
expect(page).to have_content('README.md')
expect(page).to have_content('This is a test project')
end
end
end
end
...@@ -331,10 +331,10 @@ describe Projects::BlobController do ...@@ -331,10 +331,10 @@ describe Projects::BlobController do
expect(response).to redirect_to( expect(response).to redirect_to(
project_new_merge_request_path( project_new_merge_request_path(
forked_project, forked_project,
merge_request_source_branch: "fork-test-1",
merge_request: { merge_request: {
source_project_id: forked_project.id, source_project_id: forked_project.id,
target_project_id: project.id, target_project_id: project.id,
source_branch: "fork-test-1",
target_branch: "master" target_branch: "master"
} }
) )
......
...@@ -114,33 +114,6 @@ describe 'Commits' do ...@@ -114,33 +114,6 @@ describe 'Commits' do
expect(page).to have_content 'canceled' expect(page).to have_content 'canceled'
end end
end end
describe '.gitlab-ci.yml not found warning' do
context 'ci builds enabled' do
it "does not show warning" do
visit pipeline_path(pipeline)
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
end
it 'shows warning' do
stub_ci_pipeline_yaml_file(nil)
visit pipeline_path(pipeline)
expect(page).to have_content '.gitlab-ci.yml not found in this commit'
end
end
context 'ci builds disabled' do
before do
stub_ci_builds_disabled
stub_ci_pipeline_yaml_file(nil)
visit pipeline_path(pipeline)
end
it 'does not show warning' do
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
end
end
end
end end
context "when logged as reporter" do context "when logged as reporter" do
...@@ -182,6 +155,39 @@ describe 'Commits' do ...@@ -182,6 +155,39 @@ describe 'Commits' do
end end
end end
end end
describe '.gitlab-ci.yml not found warning' do
before do
project.add_reporter(user)
end
context 'ci builds enabled' do
it 'does not show warning' do
visit pipeline_path(pipeline)
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
end
it 'shows warning' do
stub_ci_pipeline_yaml_file(nil)
visit pipeline_path(pipeline)
expect(page).to have_content '.gitlab-ci.yml not found in this commit'
end
end
context 'ci builds disabled' do
it 'does not show warning' do
stub_ci_builds_disabled
stub_ci_pipeline_yaml_file(nil)
visit pipeline_path(pipeline)
expect(page).not_to have_content '.gitlab-ci.yml not found in this commit'
end
end
end
end end
context 'viewing commits for a branch' do context 'viewing commits for a branch' do
......
...@@ -147,10 +147,12 @@ describe 'Dashboard Projects' do ...@@ -147,10 +147,12 @@ describe 'Dashboard Projects' do
end end
context 'last push widget', :use_clean_rails_memory_store_caching do context 'last push widget', :use_clean_rails_memory_store_caching do
let(:ref) { "feature" }
before do before do
event = create(:push_event, project: project, author: user) event = create(:push_event, project: project, author: user)
create(:push_event_payload, event: event, ref: 'feature', action: :created) create(:push_event_payload, event: event, ref: ref, action: :created)
Users::LastPushEventService.new(user).cache_last_push_event(event) Users::LastPushEventService.new(user).cache_last_push_event(event)
...@@ -165,9 +167,9 @@ describe 'Dashboard Projects' do ...@@ -165,9 +167,9 @@ describe 'Dashboard Projects' do
end end
expect(page).to have_selector('.merge-request-form') expect(page).to have_selector('.merge-request-form')
expect(current_path).to eq project_new_merge_request_path(project) expect(current_path).to eq project_new_merge_request_path(project, merge_request_source_branch: ref)
expect(find('#merge_request_target_project_id', visible: false).value).to eq project.id.to_s expect(find('#merge_request_target_project_id', visible: false).value).to eq project.id.to_s
expect(find('input#merge_request_source_branch', visible: false).value).to eq 'feature' expect(find('input#merge_request_source_branch', visible: false).value).to eq ref
expect(find('input#merge_request_target_branch', visible: false).value).to eq 'master' expect(find('input#merge_request_target_branch', visible: false).value).to eq 'master'
end end
end end
......
...@@ -9,10 +9,10 @@ describe 'create a merge request, allowing commits from members who can merge to ...@@ -9,10 +9,10 @@ describe 'create a merge request, allowing commits from members who can merge to
def visit_new_merge_request def visit_new_merge_request
visit project_new_merge_request_path( visit project_new_merge_request_path(
source_project, source_project,
merge_request_source_branch: 'fix',
merge_request: { merge_request: {
source_project_id: source_project.id, source_project_id: source_project.id,
target_project_id: target_project.id, target_project_id: target_project.id,
source_branch: 'fix',
target_branch: 'master' target_branch: 'master'
}) })
end end
......
...@@ -20,10 +20,10 @@ describe 'Merge request > User sees merge widget', :js do ...@@ -20,10 +20,10 @@ describe 'Merge request > User sees merge widget', :js do
before do before do
visit project_new_merge_request_path( visit project_new_merge_request_path(
project, project,
merge_request_source_branch: 'feature',
merge_request: { merge_request: {
source_project_id: project.id, source_project_id: project.id,
target_project_id: project.id, target_project_id: project.id,
source_branch: 'feature',
target_branch: 'master' target_branch: 'master'
}) })
end end
......
...@@ -13,10 +13,10 @@ describe 'Merge request > User sees WIP help message' do ...@@ -13,10 +13,10 @@ describe 'Merge request > User sees WIP help message' do
it 'shows a specific WIP hint' do it 'shows a specific WIP hint' do
visit project_new_merge_request_path( visit project_new_merge_request_path(
project, project,
merge_request_source_branch: 'wip',
merge_request: { merge_request: {
source_project_id: project.id, source_project_id: project.id,
target_project_id: project.id, target_project_id: project.id,
source_branch: 'wip',
target_branch: 'master' target_branch: 'master'
}) })
...@@ -32,10 +32,10 @@ describe 'Merge request > User sees WIP help message' do ...@@ -32,10 +32,10 @@ describe 'Merge request > User sees WIP help message' do
it 'shows the regular WIP message' do it 'shows the regular WIP message' do
visit project_new_merge_request_path( visit project_new_merge_request_path(
project, project,
merge_request_source_branch: 'fix',
merge_request: { merge_request: {
source_project_id: project.id, source_project_id: project.id,
target_project_id: project.id, target_project_id: project.id,
source_branch: 'fix',
target_branch: 'master' target_branch: 'master'
}) })
......
...@@ -130,13 +130,13 @@ describe 'Merge request > User selects branches for new MR', :js do ...@@ -130,13 +130,13 @@ describe 'Merge request > User selects branches for new MR', :js do
end end
it 'populates source branch button' do it 'populates source branch button' do
visit project_new_merge_request_path(project, change_branches: true, merge_request: { target_branch: 'master', source_branch: 'fix' }) visit project_new_merge_request_path(project, change_branches: true, merge_request_source_branch: 'fix', merge_request: { target_branch: 'master' })
expect(find('.js-source-branch')).to have_content('fix') expect(find('.js-source-branch')).to have_content('fix')
end end
it 'allows to change the diff view' do it 'allows to change the diff view' do
visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'fix' }) visit project_new_merge_request_path(project, merge_request_source_branch: 'fix', merge_request: { target_branch: 'master' })
click_link 'Changes' click_link 'Changes'
...@@ -152,7 +152,7 @@ describe 'Merge request > User selects branches for new MR', :js do ...@@ -152,7 +152,7 @@ describe 'Merge request > User selects branches for new MR', :js do
end end
it 'does not allow non-existing branches' do it 'does not allow non-existing branches' do
visit project_new_merge_request_path(project, merge_request: { target_branch: 'non-exist-target', source_branch: 'non-exist-source' }) visit project_new_merge_request_path(project, merge_request_source_branch: 'non-exist-source', merge_request: { target_branch: 'non-exist-target' })
expect(page).to have_content('The form contains the following errors') expect(page).to have_content('The form contains the following errors')
expect(page).to have_content('Source branch "non-exist-source" does not exist') expect(page).to have_content('Source branch "non-exist-source" does not exist')
...@@ -161,7 +161,7 @@ describe 'Merge request > User selects branches for new MR', :js do ...@@ -161,7 +161,7 @@ describe 'Merge request > User selects branches for new MR', :js do
context 'when a branch contains commits that both delete and add the same image' do context 'when a branch contains commits that both delete and add the same image' do
it 'renders the diff successfully' do it 'renders the diff successfully' do
visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: 'deleted-image-test' }) visit project_new_merge_request_path(project, merge_request_source_branch: 'deleted-image-test', merge_request: { target_branch: 'master' })
click_link "Changes" click_link "Changes"
...@@ -186,7 +186,8 @@ describe 'Merge request > User selects branches for new MR', :js do ...@@ -186,7 +186,8 @@ describe 'Merge request > User selects branches for new MR', :js do
it 'shows pipelines for a new merge request' do it 'shows pipelines for a new merge request' do
visit project_new_merge_request_path( visit project_new_merge_request_path(
project, project,
merge_request: { target_branch: 'master', source_branch: 'fix' }) merge_request_source_branch: 'fix',
merge_request: { target_branch: 'master' })
page.within('.merge-request') do page.within('.merge-request') do
click_link 'Pipelines' click_link 'Pipelines'
......
...@@ -144,7 +144,7 @@ describe 'Merge request > User uses quick actions', :js do ...@@ -144,7 +144,7 @@ describe 'Merge request > User uses quick actions', :js do
describe '/target_branch command in merge request' do describe '/target_branch command in merge request' do
let(:another_project) { create(:project, :public, :repository) } let(:another_project) { create(:project, :public, :repository) }
let(:new_url_opts) { { merge_request: { source_branch: 'feature' } } } let(:new_url_opts) { { merge_request_source_branch: 'feature' } }
before do before do
another_project.add_maintainer(user) another_project.add_maintainer(user)
......
...@@ -65,7 +65,7 @@ describe 'User squashes a merge request', :js do ...@@ -65,7 +65,7 @@ describe 'User squashes a merge request', :js do
context 'when squash is enabled on merge request creation' do context 'when squash is enabled on merge request creation' do
before do before do
visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: source_branch }) visit project_new_merge_request_path(project, merge_request_source_branch: source_branch, merge_request: { target_branch: 'master' })
check 'merge_request[squash]' check 'merge_request[squash]'
click_on 'Submit merge request' click_on 'Submit merge request'
wait_for_requests wait_for_requests
...@@ -95,7 +95,7 @@ describe 'User squashes a merge request', :js do ...@@ -95,7 +95,7 @@ describe 'User squashes a merge request', :js do
context 'when squash is not enabled on merge request creation' do context 'when squash is not enabled on merge request creation' do
before do before do
visit project_new_merge_request_path(project, merge_request: { target_branch: 'master', source_branch: source_branch }) visit project_new_merge_request_path(project, merge_request_source_branch: source_branch, merge_request: { target_branch: 'master' })
click_on 'Submit merge request' click_on 'Submit merge request'
wait_for_requests wait_for_requests
end end
......
...@@ -57,7 +57,7 @@ describe 'Projects > Files > User creates a directory', :js do ...@@ -57,7 +57,7 @@ describe 'Projects > Files > User creates a directory', :js do
expect(page).to have_content('From new-feature into master') expect(page).to have_content('From new-feature into master')
expect(page).to have_content('Add new directory') expect(page).to have_content('Add new directory')
expect(current_path).to eq(project_new_merge_request_path(project)) expect(current_path).to eq(project_new_merge_request_path(project, merge_request_source_branch: "new-feature"))
end end
end end
...@@ -80,8 +80,7 @@ describe 'Projects > Files > User creates a directory', :js do ...@@ -80,8 +80,7 @@ describe 'Projects > Files > User creates a directory', :js do
click_button('Create directory') click_button('Create directory')
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork, merge_request_source_branch: "patch-1"))
expect(current_path).to eq(project_new_merge_request_path(fork))
end end
end end
end end
...@@ -144,7 +144,7 @@ describe 'Projects > Files > User creates files' do ...@@ -144,7 +144,7 @@ describe 'Projects > Files > User creates files' do
fill_in(:branch_name, with: 'new_branch_name', visible: true) fill_in(:branch_name, with: 'new_branch_name', visible: true)
click_button('Commit changes') click_button('Commit changes')
expect(current_path).to eq(project_new_merge_request_path(project)) expect(current_path).to eq(project_new_merge_request_path(project, merge_request_source_branch: "new_branch_name"))
click_link('Changes') click_link('Changes')
...@@ -182,7 +182,7 @@ describe 'Projects > Files > User creates files' do ...@@ -182,7 +182,7 @@ describe 'Projects > Files > User creates files' do
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(current_path).to eq(project_new_merge_request_path(fork, merge_request_source_branch: "patch-1"))
expect(page).to have_content('New commit message') expect(page).to have_content('New commit message')
end end
end end
......
...@@ -63,7 +63,7 @@ describe 'Projects > Files > User deletes files', :js do ...@@ -63,7 +63,7 @@ describe 'Projects > Files > User deletes files', :js do
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(current_path).to eq(project_new_merge_request_path(fork, merge_request_source_branch: "patch-1"))
expect(page).to have_content('New commit message') expect(page).to have_content('New commit message')
end end
end end
......
...@@ -86,7 +86,7 @@ describe 'Projects > Files > User edits files', :js do ...@@ -86,7 +86,7 @@ describe 'Projects > Files > User edits files', :js do
fill_in(:branch_name, with: 'new_branch_name', visible: true) fill_in(:branch_name, with: 'new_branch_name', visible: true)
click_button('Commit changes') click_button('Commit changes')
expect(current_path).to eq(project_new_merge_request_path(project)) expect(current_path).to eq(project_new_merge_request_path(project, merge_request_source_branch: "new_branch_name"))
click_link('Changes') click_link('Changes')
...@@ -155,7 +155,7 @@ describe 'Projects > Files > User edits files', :js do ...@@ -155,7 +155,7 @@ describe 'Projects > Files > User edits files', :js do
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(current_path).to eq(project_new_merge_request_path(fork, merge_request_source_branch: "patch-1"))
wait_for_requests wait_for_requests
...@@ -183,7 +183,7 @@ describe 'Projects > Files > User edits files', :js do ...@@ -183,7 +183,7 @@ describe 'Projects > Files > User edits files', :js do
fork = user.fork_of(project2) fork = user.fork_of(project2)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(current_path).to eq(project_new_merge_request_path(fork, merge_request_source_branch: "patch-1"))
wait_for_requests wait_for_requests
......
...@@ -78,7 +78,7 @@ describe 'Projects > Files > User replaces files', :js do ...@@ -78,7 +78,7 @@ describe 'Projects > Files > User replaces files', :js do
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(current_path).to eq(project_new_merge_request_path(fork, merge_request_source_branch: "undefined"))
click_link('Changes') click_link('Changes')
......
...@@ -36,7 +36,7 @@ describe 'Projects > Files > User uploads files' do ...@@ -36,7 +36,7 @@ describe 'Projects > Files > User uploads files' do
click_button('Upload file') click_button('Upload file')
expect(page).to have_content('New commit message') expect(page).to have_content('New commit message')
expect(current_path).to eq(project_new_merge_request_path(project)) expect(current_path).to eq(project_new_merge_request_path(project, merge_request_source_branch: "new_branch_name"))
click_link('Changes') click_link('Changes')
find("a[data-action='diffs']", text: 'Changes').click find("a[data-action='diffs']", text: 'Changes').click
...@@ -92,7 +92,7 @@ describe 'Projects > Files > User uploads files' do ...@@ -92,7 +92,7 @@ describe 'Projects > Files > User uploads files' do
fork = user.fork_of(project2.reload) fork = user.fork_of(project2.reload)
expect(current_path).to eq(project_new_merge_request_path(fork)) expect(current_path).to eq(project_new_merge_request_path(fork, merge_request_source_branch: "undefined"))
find("a[data-action='diffs']", text: 'Changes').click find("a[data-action='diffs']", text: 'Changes').click
......
...@@ -22,8 +22,8 @@ describe 'Merge Request button' do ...@@ -22,8 +22,8 @@ describe 'Merge Request button' do
it 'shows Create merge request button' do it 'shows Create merge request button' do
href = project_new_merge_request_path(project, href = project_new_merge_request_path(project,
merge_request: { source_branch: 'feature', merge_request_source_branch: 'feature',
target_branch: 'master' }) merge_request: { target_branch: 'master' })
visit url visit url
...@@ -77,8 +77,8 @@ describe 'Merge Request button' do ...@@ -77,8 +77,8 @@ describe 'Merge Request button' do
it 'shows Create merge request button' do it 'shows Create merge request button' do
href = project_new_merge_request_path(forked_project, href = project_new_merge_request_path(forked_project,
merge_request: { source_branch: 'feature', merge_request_source_branch: 'feature',
target_branch: 'master' }) merge_request: { target_branch: 'master' })
visit fork_url visit fork_url
......
// TODO: https://gitlab.com/gitlab-org/gitlab-ce/issues/48034 import Vue from 'vue';
import CompareVersionsComponent from '~/diffs/components/compare_versions.vue';
import store from '~/mr_notes/stores';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import diffsMockData from '../mock_data/merge_request_diffs';
describe('CompareVersions', () => {
let vm;
const targetBranch = { branchName: 'tmp-wine-dev', versionIndex: -1 };
beforeEach(() => {
vm = createComponentWithStore(Vue.extend(CompareVersionsComponent), store, {
mergeRequestDiffs: diffsMockData,
mergeRequestDiff: diffsMockData[0],
targetBranch,
}).$mount();
});
describe('template', () => {
it('should render Tree List toggle button with correct attribute values', () => {
const treeListBtn = vm.$el.querySelector('.js-toggle-tree-list');
expect(treeListBtn).not.toBeNull();
expect(treeListBtn.dataset.originalTitle).toBe('Toggle file browser');
expect(treeListBtn.querySelectorAll('svg use').length).not.toBe(0);
expect(treeListBtn.querySelector('svg use').getAttribute('xlink:href')).toContain(
'#hamburger',
);
});
it('should render comparison dropdowns with correct values', () => {
const sourceDropdown = vm.$el.querySelector('.mr-version-dropdown');
const targetDropdown = vm.$el.querySelector('.mr-version-compare-dropdown');
expect(sourceDropdown).not.toBeNull();
expect(targetDropdown).not.toBeNull();
expect(sourceDropdown.querySelector('a span').innerHTML).toContain('latest version');
expect(targetDropdown.querySelector('a span').innerHTML).toContain(targetBranch.branchName);
});
it('should not render comparison dropdowns if no mergeRequestDiffs are specified', () => {
vm.mergeRequestDiffs = [];
vm.$nextTick(() => {
const sourceDropdown = vm.$el.querySelector('.mr-version-dropdown');
const targetDropdown = vm.$el.querySelector('.mr-version-compare-dropdown');
expect(sourceDropdown).toBeNull();
expect(targetDropdown).toBeNull();
});
});
it('should render whitespace toggle button with correct attributes', () => {
const whitespaceBtn = vm.$el.querySelector('.qa-toggle-whitespace');
const href = vm.toggleWhitespacePath;
expect(whitespaceBtn).not.toBeNull();
expect(whitespaceBtn.getAttribute('href')).toEqual(href);
expect(whitespaceBtn.innerHTML).toContain('Hide whitespace changes');
});
it('should render view types buttons with correct values', () => {
const inlineBtn = vm.$el.querySelector('#inline-diff-btn');
const parallelBtn = vm.$el.querySelector('#parallel-diff-btn');
expect(inlineBtn).not.toBeNull();
expect(parallelBtn).not.toBeNull();
expect(inlineBtn.dataset.viewType).toEqual('inline');
expect(parallelBtn.dataset.viewType).toEqual('parallel');
expect(inlineBtn.innerHTML).toContain('Inline');
expect(parallelBtn.innerHTML).toContain('Side-by-side');
});
});
describe('setInlineDiffViewType', () => {
it('should persist the view type in the url', () => {
const viewTypeBtn = vm.$el.querySelector('#inline-diff-btn');
viewTypeBtn.click();
expect(window.location.toString()).toContain('?view=inline');
});
});
describe('setParallelDiffViewType', () => {
it('should persist the view type in the url', () => {
const viewTypeBtn = vm.$el.querySelector('#parallel-diff-btn');
viewTypeBtn.click();
expect(window.location.toString()).toContain('?view=parallel');
});
});
describe('comparableDiffs', () => {
it('should not contain the first item in the mergeRequestDiffs property', () => {
const { comparableDiffs } = vm;
const comparableDiffsMock = diffsMockData.slice(1);
expect(comparableDiffs).toEqual(comparableDiffsMock);
});
});
describe('isWhitespaceVisible', () => {
const originalHref = window.location.href;
afterEach(() => {
window.history.replaceState({}, null, originalHref);
});
it('should return "true" when no "w" flag is present in the URL (default)', () => {
expect(vm.isWhitespaceVisible()).toBe(true);
});
it('should return "false" when the flag is set to "1" in the URL', () => {
window.history.replaceState({}, null, '?w=1');
expect(vm.isWhitespaceVisible()).toBe(false);
});
it('should return "true" when the flag is set to "0" in the URL', () => {
window.history.replaceState({}, null, '?w=0');
expect(vm.isWhitespaceVisible()).toBe(true);
});
});
});
export default [
{
versionIndex: 4,
createdAt: '2018-10-23T11:49:16.611Z',
commitsCount: 4,
latest: true,
shortCommitSha: 'de7a8f7f',
versionPath: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=37',
comparePath:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=de7a8f7f20c3ea2e0bef3ba01cfd41c21f6b4995',
},
{
versionIndex: 3,
createdAt: '2018-10-23T11:46:40.617Z',
commitsCount: 3,
latest: false,
shortCommitSha: 'e78fc18f',
versionPath: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=36',
comparePath:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=e78fc18fa37acb2185c59ca94d4a964464feb50e',
},
{
versionIndex: 2,
createdAt: '2018-10-04T09:57:39.648Z',
commitsCount: 2,
latest: false,
shortCommitSha: '48da7e7e',
versionPath: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=35',
comparePath:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=48da7e7e9a99d41c852578bd9cb541ca4d864b3e',
},
{
versionIndex: 1,
createdAt: '2018-09-25T20:30:39.493Z',
commitsCount: 1,
latest: false,
shortCommitSha: '47bac2ed',
versionPath: '/gnuwget/wget2/merge_requests/6/diffs?diff_id=20',
comparePath:
'/gnuwget/wget2/merge_requests/6/diffs?diff_id=37&start_sha=47bac2ed972c5bee344c1cea159a22cd7f711dc0',
},
];
// import $ from 'jquery';
// import MockAdapter from 'axios-mock-adapter';
// import axios from '~/lib/utils/axios_utils';
// import { numberToHumanSize } from '~/lib/utils/number_utils';
// import '~/lib/utils/datetime_utility';
// import Job from '~/job';
// import '~/breakpoints';
// import waitForPromises from 'spec/helpers/wait_for_promises';
// describe('Job', () => {
// const JOB_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/-/jobs/1`;
// let mock;
// let response;
// let job;
// preloadFixtures('builds/build-with-artifacts.html.raw');
// beforeEach(() => {
// loadFixtures('builds/build-with-artifacts.html.raw');
// spyOnDependency(Job, 'visitUrl');
// response = {};
// mock = new MockAdapter(axios);
// mock.onGet(new RegExp(`${JOB_URL}/trace.json?(.*)`)).reply(() => [200, response]);
// });
// afterEach(() => {
// mock.restore();
// clearTimeout(job.timeout);
// });
// describe('class constructor', () => {
// beforeEach(() => {
// jasmine.clock().install();
// });
// afterEach(() => {
// jasmine.clock().uninstall();
// });
// describe('running build', () => {
// it('updates the build trace on an interval', function (done) {
// response = {
// html: '<span>Update<span>',
// status: 'running',
// state: 'newstate',
// append: true,
// complete: false,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect($('#build-trace .js-build-output').text()).toMatch(/Update/);
// expect(job.state).toBe('newstate');
// response = {
// html: '<span>More</span>',
// status: 'running',
// state: 'finalstate',
// append: true,
// complete: true,
// };
// })
// .then(() => jasmine.clock().tick(4001))
// .then(waitForPromises)
// .then(() => {
// expect($('#build-trace .js-build-output').text()).toMatch(/UpdateMore/);
// expect(job.state).toBe('finalstate');
// })
// .then(done)
// .catch(done.fail);
// });
// it('replaces the entire build trace', (done) => {
// response = {
// html: '<span>Update<span>',
// status: 'running',
// append: false,
// complete: false,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect($('#build-trace .js-build-output').text()).toMatch(/Update/);
// response = {
// html: '<span>Different</span>',
// status: 'running',
// append: false,
// };
// })
// .then(() => jasmine.clock().tick(4001))
// .then(waitForPromises)
// .then(() => {
// expect($('#build-trace .js-build-output').text()).not.toMatch(/Update/);
// expect($('#build-trace .js-build-output').text()).toMatch(/Different/);
// })
// .then(done)
// .catch(done.fail);
// });
// });
// describe('truncated information', () => {
// describe('when size is less than total', () => {
// it('shows information about truncated log', (done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(document.querySelector('.js-truncated-info').classList).not.toContain('hidden');
// })
// .then(done)
// .catch(done.fail);
// });
// it('shows the size in KiB', (done) => {
// const size = 50;
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(
// document.querySelector('.js-truncated-info-size').textContent.trim(),
// ).toEqual(`${numberToHumanSize(size)}`);
// })
// .then(done)
// .catch(done.fail);
// });
// it('shows incremented size', (done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// complete: false,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(
// document.querySelector('.js-truncated-info-size').textContent.trim(),
// ).toEqual(`${numberToHumanSize(50)}`);
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: true,
// size: 10,
// total: 100,
// complete: true,
// };
// })
// .then(() => jasmine.clock().tick(4001))
// .then(waitForPromises)
// .then(() => {
// expect(
// document.querySelector('.js-truncated-info-size').textContent.trim(),
// ).toEqual(`${numberToHumanSize(60)}`);
// })
// .then(done)
// .catch(done.fail);
// });
// it('renders the raw link', () => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// };
// job = new Job();
// expect(
// document.querySelector('.js-raw-link').textContent.trim(),
// ).toContain('Complete Raw');
// });
// });
// describe('when size is equal than total', () => {
// it('does not show the trunctated information', (done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 100,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(() => {
// expect(document.querySelector('.js-truncated-info').classList).toContain('hidden');
// })
// .then(done)
// .catch(done.fail);
// });
// });
// });
// describe('output trace', () => {
// beforeEach((done) => {
// response = {
// html: '<span>Update</span>',
// status: 'success',
// append: false,
// size: 50,
// total: 100,
// };
// job = new Job();
// waitForPromises()
// .then(done)
// .catch(done.fail);
// });
// it('should render trace controls', () => {
// const controllers = document.querySelector('.controllers');
// expect(controllers.querySelector('.js-raw-link-controller')).not.toBeNull();
// expect(controllers.querySelector('.js-scroll-up')).not.toBeNull();
// expect(controllers.querySelector('.js-scroll-down')).not.toBeNull();
// });
// it('should render received output', () => {
// expect(
// document.querySelector('.js-build-output').innerHTML,
// ).toEqual('<span>Update</span>');
// });
// });
// });
// });
...@@ -77,7 +77,7 @@ describe('collapsedGroupedDatePicker', () => { ...@@ -77,7 +77,7 @@ describe('collapsedGroupedDatePicker', () => {
expect(icons[0].innerText.trim()).toEqual('None'); expect(icons[0].innerText.trim()).toEqual('None');
}); });
it('should have tooltip as `Start and due dates`', () => { it('should have tooltip as `Start and due date`', () => {
const icons = vm.$el.querySelectorAll('.sidebar-collapsed-icon'); const icons = vm.$el.querySelectorAll('.sidebar-collapsed-icon');
expect(icons[0].dataset.originalTitle).toBe('Start and due date'); expect(icons[0].dataset.originalTitle).toBe('Start and due date');
......
...@@ -683,7 +683,7 @@ describe API::Internal do ...@@ -683,7 +683,7 @@ describe API::Internal do
expect(json_response).to match [{ expect(json_response).to match [{
"branch_name" => "new_branch", "branch_name" => "new_branch",
"url" => "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch", "url" => "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new/new_branch",
"new_merge_request" => true "new_merge_request" => true
}] }]
end end
...@@ -704,7 +704,7 @@ describe API::Internal do ...@@ -704,7 +704,7 @@ describe API::Internal do
expect(json_response).to match [{ expect(json_response).to match [{
"branch_name" => "new_branch", "branch_name" => "new_branch",
"url" => "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch", "url" => "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new/new_branch",
"new_merge_request" => true "new_merge_request" => true
}] }]
end end
...@@ -837,7 +837,7 @@ describe API::Internal do ...@@ -837,7 +837,7 @@ describe API::Internal do
expect(json_response['merge_request_urls']).to match [{ expect(json_response['merge_request_urls']).to match [{
"branch_name" => "new_branch", "branch_name" => "new_branch",
"url" => "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch", "url" => "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new/new_branch",
"new_merge_request" => true "new_merge_request" => true
}] }]
end end
......
...@@ -6,7 +6,7 @@ describe MergeRequests::GetUrlsService do ...@@ -6,7 +6,7 @@ describe MergeRequests::GetUrlsService do
let(:project) { create(:project, :public, :repository) } let(:project) { create(:project, :public, :repository) }
let(:service) { described_class.new(project) } let(:service) { described_class.new(project) }
let(:source_branch) { "merge-test" } let(:source_branch) { "merge-test" }
let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new?merge_request%5Bsource_branch%5D=#{source_branch}" } let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new/#{source_branch}" }
let(:show_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/#{merge_request.iid}" } let(:show_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/#{merge_request.iid}" }
let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{source_branch}" } let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{source_branch}" }
let(:deleted_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 #{Gitlab::Git::BLANK_SHA} refs/heads/#{source_branch}" } let(:deleted_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 #{Gitlab::Git::BLANK_SHA} refs/heads/#{source_branch}" }
...@@ -117,7 +117,7 @@ describe MergeRequests::GetUrlsService do ...@@ -117,7 +117,7 @@ describe MergeRequests::GetUrlsService do
let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/new_branch" } let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/new_branch" }
let(:existing_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/markdown" } let(:existing_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/markdown" }
let(:changes) { "#{new_branch_changes}\n#{existing_branch_changes}" } let(:changes) { "#{new_branch_changes}\n#{existing_branch_changes}" }
let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch" } let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new/new_branch" }
it 'returns 2 urls for both creating new and showing merge request' do it 'returns 2 urls for both creating new and showing merge request' do
result = service.execute(changes) result = service.execute(changes)
......
...@@ -17,10 +17,10 @@ RSpec.shared_examples 'a creatable merge request' do ...@@ -17,10 +17,10 @@ RSpec.shared_examples 'a creatable merge request' do
sign_in(user) sign_in(user)
visit project_new_merge_request_path( visit project_new_merge_request_path(
target_project, target_project,
merge_request_source_branch: 'fix',
merge_request: { merge_request: {
source_project_id: source_project.id, source_project_id: source_project.id,
target_project_id: target_project.id, target_project_id: target_project.id,
source_branch: 'fix',
target_branch: 'master' target_branch: 'master'
}) })
end end
......
...@@ -626,10 +626,10 @@ ...@@ -626,10 +626,10 @@
resolved "https://registry.yarnpkg.com/@gitlab-org/gitlab-svgs/-/gitlab-svgs-1.33.0.tgz#068566e8ee00795f6f09f58236f08e1716f9f04a" resolved "https://registry.yarnpkg.com/@gitlab-org/gitlab-svgs/-/gitlab-svgs-1.33.0.tgz#068566e8ee00795f6f09f58236f08e1716f9f04a"
integrity sha512-8ajtUHk6gQ1xosL/CO5IzHSFM/t18hx5pfzQ3cd0VuQXcyR6QKGuXTLwbYdmJDYOw1Etoo5DqDWxPEClHyZpiA== integrity sha512-8ajtUHk6gQ1xosL/CO5IzHSFM/t18hx5pfzQ3cd0VuQXcyR6QKGuXTLwbYdmJDYOw1Etoo5DqDWxPEClHyZpiA==
"@gitlab-org/gitlab-ui@^1.8.0": "@gitlab-org/gitlab-ui@^1.9.0":
version "1.8.0" version "1.9.0"
resolved "https://registry.yarnpkg.com/@gitlab-org/gitlab-ui/-/gitlab-ui-1.8.0.tgz#dee33d78f68c91644273dbd51734b796108263ee" resolved "https://registry.yarnpkg.com/@gitlab-org/gitlab-ui/-/gitlab-ui-1.9.0.tgz#c47851587316f60926e8304747d1fcdd1222c779"
integrity sha512-Owm8bkP4vEihiLD3pmMw1r+UWr3WYGaGUtj0JcwaAg3d05ZneozFEZjazIOWeYTcFsk+ZvNmSk1UA+ARIauhgQ== integrity sha512-OQ/mhWnbeG4pmjnCGwLsyvmHDYdLh2IRnt4Jx6G9jf96oyjEHzY1rveImfqcQ2bvx9azfuI6CU9dmDSY3aWvvQ==
dependencies: dependencies:
"@gitlab-org/gitlab-svgs" "^1.23.0" "@gitlab-org/gitlab-svgs" "^1.23.0"
bootstrap-vue "^2.0.0-rc.11" bootstrap-vue "^2.0.0-rc.11"
...@@ -5502,12 +5502,7 @@ mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: ...@@ -5502,12 +5502,7 @@ mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0:
dependencies: dependencies:
minimist "0.0.8" minimist "0.0.8"
moment@2.x: moment@2.x, moment@^2.21.0:
version "2.19.2"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.2.tgz#8a7f774c95a64550b4c7ebd496683908f9419dbe"
integrity sha512-Rf6jiHPEfxp9+dlzxPTmRHbvoFXsh2L/U8hOupUMpnuecHQmI6cF6lUbJl3QqKPko1u6ujO+FxtcajLVfLpAtA==
moment@^2.21.0:
version "2.22.2" version "2.22.2"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66" resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y= integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=
......
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