diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-06 00:09:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-06 00:09:02 +0300 |
commit | 76623c12c136f43f24c3966ed4b469e2c0b434b7 (patch) | |
tree | 7c5ec884c25e03e4fea131a4d112a9d0ccfd59b8 /app | |
parent | b042382bbf5a4977c5b5c6b0a9a33f4e8ca8d16d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/commons/polyfills.js | 22 | ||||
-rw-r--r-- | app/assets/javascripts/gfm_auto_complete.js | 57 | ||||
-rw-r--r-- | app/assets/javascripts/ide/stores/modules/commit/actions.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/monitoring/components/charts/time_series.vue | 2 | ||||
-rw-r--r-- | app/assets/javascripts/test_utils/index.js | 2 | ||||
-rw-r--r-- | app/models/project_services/flowdock_service.rb | 2 | ||||
-rw-r--r-- | app/models/repository.rb | 4 | ||||
-rw-r--r-- | app/views/clusters/clusters/gcp/_form.html.haml | 2 | ||||
-rw-r--r-- | app/workers/concerns/worker_attributes.rb | 3 |
9 files changed, 63 insertions, 35 deletions
diff --git a/app/assets/javascripts/commons/polyfills.js b/app/assets/javascripts/commons/polyfills.js index dd300b8a307..dec3c637c22 100644 --- a/app/assets/javascripts/commons/polyfills.js +++ b/app/assets/javascripts/commons/polyfills.js @@ -1,24 +1,4 @@ -// ECMAScript polyfills -import 'core-js/es/array/fill'; -import 'core-js/es/array/find'; -import 'core-js/es/array/find-index'; -import 'core-js/es/array/from'; -import 'core-js/es/array/includes'; -import 'core-js/es/number/is-integer'; -import 'core-js/es/object/assign'; -import 'core-js/es/object/values'; -import 'core-js/es/object/entries'; -import 'core-js/es/promise'; -import 'core-js/es/promise/finally'; -import 'core-js/es/string/code-point-at'; -import 'core-js/es/string/from-code-point'; -import 'core-js/es/string/includes'; -import 'core-js/es/string/starts-with'; -import 'core-js/es/string/ends-with'; -import 'core-js/es/symbol'; -import 'core-js/es/map'; -import 'core-js/es/weak-map'; -import 'core-js/modules/web.url'; +import 'core-js/stable'; // Browser polyfills import 'formdata-polyfill'; diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index de69daf5c22..c762e298eb8 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -1,6 +1,7 @@ import $ from 'jquery'; import 'at.js'; import _ from 'underscore'; +import SidebarMediator from '~/sidebar/sidebar_mediator'; import glRegexp from './lib/utils/regexp'; import AjaxCache from './lib/utils/ajax_cache'; import { spriteIcon } from './lib/utils/common_utils'; @@ -53,8 +54,8 @@ export const defaultAutocompleteConfig = { }; class GfmAutoComplete { - constructor(dataSources) { - this.dataSources = dataSources || {}; + constructor(dataSources = {}) { + this.dataSources = dataSources; this.cachedData = {}; this.isLoadingData = {}; } @@ -199,6 +200,16 @@ class GfmAutoComplete { } setupMembers($input) { + const fetchData = this.fetchData.bind(this); + const MEMBER_COMMAND = { + ASSIGN: '/assign', + UNASSIGN: '/unassign', + REASSIGN: '/reassign', + CC: '/cc', + }; + let assignees = []; + let command = ''; + // Team Members $input.atwho({ at: '@', @@ -225,6 +236,48 @@ class GfmAutoComplete { callbacks: { ...this.getDefaultCallbacks(), beforeSave: membersBeforeSave, + matcher(flag, subtext) { + const subtextNodes = subtext + .split(/\n+/g) + .pop() + .split(GfmAutoComplete.regexSubtext); + + // Check if @ is followed by '/assign', '/reassign', '/unassign' or '/cc' commands. + command = subtextNodes.find(node => { + if (Object.values(MEMBER_COMMAND).includes(node)) { + return node; + } + return null; + }); + + // Cache assignees list for easier filtering later + assignees = SidebarMediator.singleton?.store?.assignees?.map( + assignee => `${assignee.username} ${assignee.name}`, + ); + + const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers); + return match && match.length ? match[1] : null; + }, + filter(query, data, searchKey) { + if (GfmAutoComplete.isLoading(data)) { + fetchData(this.$inputor, this.at); + return data; + } + + if (data === GfmAutoComplete.defaultLoadingData) { + return $.fn.atwho.default.callbacks.filter(query, data, searchKey); + } + + if (command === MEMBER_COMMAND.ASSIGN) { + // Only include members which are not assigned to Issuable currently + return data.filter(member => !assignees.includes(member.search)); + } else if (command === MEMBER_COMMAND.UNASSIGN) { + // Only include members which are assigned to Issuable currently + return data.filter(member => assignees.includes(member.search)); + } + + return data; + }, }, }); } diff --git a/app/assets/javascripts/ide/stores/modules/commit/actions.js b/app/assets/javascripts/ide/stores/modules/commit/actions.js index 73c1bc8b582..0740e0523a9 100644 --- a/app/assets/javascripts/ide/stores/modules/commit/actions.js +++ b/app/assets/javascripts/ide/stores/modules/commit/actions.js @@ -44,7 +44,7 @@ export const setLastCommitMessage = ({ commit, rootGetters }, data) => { const commitMsg = sprintf( __('Your changes have been committed. Commit %{commitId} %{commitStats}'), { - commitId: `<a href="${currentProject.web_url}/commit/${data.short_id}" class="commit-sha">${data.short_id}</a>`, + commitId: `<a href="${currentProject.web_url}/-/commit/${data.short_id}" class="commit-sha">${data.short_id}</a>`, commitStats, }, false, @@ -56,7 +56,7 @@ export const setLastCommitMessage = ({ commit, rootGetters }, data) => { export const updateFilesAfterCommit = ({ commit, dispatch, rootState, rootGetters }, { data }) => { const selectedProject = rootGetters.currentProject; const lastCommit = { - commit_path: `${selectedProject.web_url}/commit/${data.id}`, + commit_path: `${selectedProject.web_url}/-/commit/${data.id}`, commit: { id: data.id, message: data.message, diff --git a/app/assets/javascripts/monitoring/components/charts/time_series.vue b/app/assets/javascripts/monitoring/components/charts/time_series.vue index e79755f4fb2..e58d9f23201 100644 --- a/app/assets/javascripts/monitoring/components/charts/time_series.vue +++ b/app/assets/javascripts/monitoring/components/charts/time_series.vue @@ -209,7 +209,7 @@ export default { id, createdAt: created_at, sha, - commitUrl: `${this.projectPath}/commit/${sha}`, + commitUrl: `${this.projectPath}/-/commit/${sha}`, tag, tagUrl: tag ? `${this.tagsPath}/${ref.name}` : null, ref: ref.name, diff --git a/app/assets/javascripts/test_utils/index.js b/app/assets/javascripts/test_utils/index.js index 1a1f3e8d0a8..2727485fb95 100644 --- a/app/assets/javascripts/test_utils/index.js +++ b/app/assets/javascripts/test_utils/index.js @@ -1,5 +1,3 @@ -import 'core-js/es/map'; -import 'core-js/es/set'; import { Sortable } from 'sortablejs'; import simulateDrag from './simulate_drag'; import simulateInput from './simulate_input'; diff --git a/app/models/project_services/flowdock_service.rb b/app/models/project_services/flowdock_service.rb index 094488cb431..e721fded1d9 100644 --- a/app/models/project_services/flowdock_service.rb +++ b/app/models/project_services/flowdock_service.rb @@ -36,7 +36,7 @@ class FlowdockService < Service token: token, repo: project.repository, repo_url: "#{Gitlab.config.gitlab.url}/#{project.full_path}", - commit_url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/commit/%s", + commit_url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/-/commit/%s", diff_url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/compare/%s...%s" ) end diff --git a/app/models/repository.rb b/app/models/repository.rb index d720980faab..825fddf4e63 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -451,10 +451,6 @@ class Repository return unless repo_type.project? - # This call is stubbed in tests due to being an expensive operation - # It can be reenabled for specific tests via: - # - # allow(DetectRepositoryLanguagesWorker).to receive(:perform_async).and_call_original DetectRepositoryLanguagesWorker.perform_async(project.id) end diff --git a/app/views/clusters/clusters/gcp/_form.html.haml b/app/views/clusters/clusters/gcp/_form.html.haml index 17f6a064c0e..66da76d7a43 100644 --- a/app/views/clusters/clusters/gcp/_form.html.haml +++ b/app/views/clusters/clusters/gcp/_form.html.haml @@ -66,7 +66,7 @@ - if Feature.enabled?(:create_cloud_run_clusters, clusterable, default_enabled: true) .form-group - = provider_gcp_field.check_box :cloud_run, { label: s_('ClusterIntegration|Enable Cloud Run on GKE (beta)'), + = provider_gcp_field.check_box :cloud_run, { label: s_('ClusterIntegration|Enable Cloud Run for Anthos'), label_class: 'label-bold' } .form-text.text-muted = s_('ClusterIntegration|Uses the Cloud Run, Istio, and HTTP Load Balancing addons for this cluster.') diff --git a/app/workers/concerns/worker_attributes.rb b/app/workers/concerns/worker_attributes.rb index 266c8021761..babdb46bb85 100644 --- a/app/workers/concerns/worker_attributes.rb +++ b/app/workers/concerns/worker_attributes.rb @@ -22,7 +22,8 @@ module WorkerAttributes # EE-specific epics: 2, - incident_management: 2 + incident_management: 2, + security_scans: 2 }.stringify_keys.freeze class_methods do |