diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/ide/components/ide_status_bar.vue | 10 | ||||
-rw-r--r-- | app/assets/javascripts/ide/components/ide_status_mr.vue | 28 | ||||
-rw-r--r-- | app/assets/javascripts/ide/components/merge_requests/info.vue | 38 | ||||
-rw-r--r-- | app/assets/javascripts/ide/components/panes/right.vue | 7 | ||||
-rw-r--r-- | app/assets/javascripts/ide/stores/actions/merge_request.js | 4 | ||||
-rw-r--r-- | app/controllers/admin/logs_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/projects/services_controller.rb | 14 | ||||
-rw-r--r-- | app/services/concerns/akismet_methods.rb | 2 | ||||
-rw-r--r-- | app/services/issuable_base_service.rb | 8 | ||||
-rw-r--r-- | app/services/spam/ham_service.rb | 22 | ||||
-rw-r--r-- | app/workers/stuck_ci_jobs_worker.rb | 6 |
11 files changed, 72 insertions, 69 deletions
diff --git a/app/assets/javascripts/ide/components/ide_status_bar.vue b/app/assets/javascripts/ide/components/ide_status_bar.vue index 6eaf08e8033..4da417a37ce 100644 --- a/app/assets/javascripts/ide/components/ide_status_bar.vue +++ b/app/assets/javascripts/ide/components/ide_status_bar.vue @@ -2,6 +2,7 @@ /* eslint-disable @gitlab/vue-i18n/no-bare-strings */ import { mapActions, mapState, mapGetters } from 'vuex'; import IdeStatusList from 'ee_else_ce/ide/components/ide_status_list.vue'; +import IdeStatusMr from './ide_status_mr.vue'; import icon from '~/vue_shared/components/icon.vue'; import tooltip from '~/vue_shared/directives/tooltip'; import timeAgoMixin from '~/vue_shared/mixins/timeago'; @@ -15,6 +16,7 @@ export default { userAvatarImage, CiIcon, IdeStatusList, + IdeStatusMr, }, directives: { tooltip, @@ -27,7 +29,7 @@ export default { }, computed: { ...mapState(['currentBranchId', 'currentProjectId']), - ...mapGetters(['currentProject', 'lastCommit']), + ...mapGetters(['currentProject', 'lastCommit', 'currentMergeRequest']), ...mapState('pipelines', ['latestPipeline']), }, watch: { @@ -121,6 +123,12 @@ export default { >{{ lastCommitFormattedAge }}</time > </div> + <ide-status-mr + v-if="currentMergeRequest" + class="mx-3" + :url="currentMergeRequest.web_url" + :text="currentMergeRequest.references.short" + /> <ide-status-list class="ml-auto" /> </footer> </template> diff --git a/app/assets/javascripts/ide/components/ide_status_mr.vue b/app/assets/javascripts/ide/components/ide_status_mr.vue new file mode 100644 index 00000000000..a3b26d23a17 --- /dev/null +++ b/app/assets/javascripts/ide/components/ide_status_mr.vue @@ -0,0 +1,28 @@ +<script> +import { GlIcon, GlLink } from '@gitlab/ui'; + +export default { + components: { + GlIcon, + GlLink, + }, + props: { + text: { + type: String, + required: true, + }, + url: { + type: String, + required: true, + }, + }, +}; +</script> + +<template> + <div class="d-flex-center flex-nowrap text-nowrap js-ide-status-mr"> + <gl-icon name="merge-request" /> + <span class="ml-1 d-none d-sm-block">{{ s__('WebIDE|Merge request') }}</span> + <gl-link class="ml-1" :href="url">{{ text }}</gl-link> + </div> +</template> diff --git a/app/assets/javascripts/ide/components/merge_requests/info.vue b/app/assets/javascripts/ide/components/merge_requests/info.vue deleted file mode 100644 index 73ec992466c..00000000000 --- a/app/assets/javascripts/ide/components/merge_requests/info.vue +++ /dev/null @@ -1,38 +0,0 @@ -<script> -import { mapGetters } from 'vuex'; -import Icon from '../../../vue_shared/components/icon.vue'; -import TitleComponent from '../../../issue_show/components/title.vue'; -import DescriptionComponent from '../../../issue_show/components/description.vue'; - -export default { - components: { - Icon, - TitleComponent, - DescriptionComponent, - }, - computed: { - ...mapGetters(['currentMergeRequest']), - }, -}; -</script> - -<template> - <div class="ide-merge-request-info h-100 d-flex flex-column"> - <div class="detail-page-header"> - <icon name="git-merge" class="align-self-center append-right-8" /> - <strong> !{{ currentMergeRequest.iid }} </strong> - </div> - <div class="issuable-details"> - <title-component - :issuable-ref="currentMergeRequest.iid" - :title-html="currentMergeRequest.title_html" - :title-text="currentMergeRequest.title" - /> - <description-component - :description-html="currentMergeRequest.description_html" - :description-text="currentMergeRequest.description" - :can-update="false" - /> - </div> - </div> -</template> diff --git a/app/assets/javascripts/ide/components/panes/right.vue b/app/assets/javascripts/ide/components/panes/right.vue index 40ed7d9c422..4a9de9e0c03 100644 --- a/app/assets/javascripts/ide/components/panes/right.vue +++ b/app/assets/javascripts/ide/components/panes/right.vue @@ -3,7 +3,6 @@ import { mapGetters, mapState } from 'vuex'; import { __ } from '~/locale'; import CollapsibleSidebar from './collapsible_sidebar.vue'; import { rightSidebarViews } from '../../constants'; -import MergeRequestInfo from '../merge_requests/info.vue'; import PipelinesList from '../pipelines/list.vue'; import JobsDetail from '../jobs/detail.vue'; import Clientside from '../preview/clientside.vue'; @@ -29,12 +28,6 @@ export default { rightExtensionTabs() { return [ { - show: Boolean(this.currentMergeRequestId), - title: __('Merge Request'), - views: [{ component: MergeRequestInfo, ...rightSidebarViews.mergeRequestInfo }], - icon: 'text-description', - }, - { show: true, title: __('Pipelines'), views: [ diff --git a/app/assets/javascripts/ide/stores/actions/merge_request.js b/app/assets/javascripts/ide/stores/actions/merge_request.js index 6144452c80b..aa44067edf8 100644 --- a/app/assets/javascripts/ide/stores/actions/merge_request.js +++ b/app/assets/javascripts/ide/stores/actions/merge_request.js @@ -44,9 +44,7 @@ export const getMergeRequestData = ( new Promise((resolve, reject) => { if (!state.projects[projectId].mergeRequests[mergeRequestId] || force) { service - .getProjectMergeRequestData(targetProjectId || projectId, mergeRequestId, { - render_html: true, - }) + .getProjectMergeRequestData(targetProjectId || projectId, mergeRequestId) .then(({ data }) => { commit(types.SET_MERGE_REQUEST, { projectPath: projectId, diff --git a/app/controllers/admin/logs_controller.rb b/app/controllers/admin/logs_controller.rb index 14245300633..3ae0aef0fa4 100644 --- a/app/controllers/admin/logs_controller.rb +++ b/app/controllers/admin/logs_controller.rb @@ -10,7 +10,7 @@ class Admin::LogsController < Admin::ApplicationController def loggers @loggers ||= [ - Gitlab::AppLogger, + Gitlab::AppJsonLogger, Gitlab::GitLogger, Gitlab::EnvironmentLogger, Gitlab::SidekiqLogger, diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index daaca9e1268..c916140211e 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -8,6 +8,8 @@ class Projects::ServicesController < Projects::ApplicationController before_action :ensure_service_enabled before_action :service before_action :web_hook_logs, only: [:edit, :update] + before_action :set_deprecation_notice_for_prometheus_service, only: [:edit, :update] + before_action :redirect_deprecated_prometheus_service, only: [:update] respond_to :html @@ -93,4 +95,16 @@ class Projects::ServicesController < Projects::ApplicationController .as_json(only: @service.json_fields) .merge(errors: @service.errors.as_json) end + + def redirect_deprecated_prometheus_service + redirect_to edit_project_service_path(project, @service) if @service.is_a?(::PrometheusService) && Feature.enabled?(:settings_operations_prometheus_service, project) + end + + def set_deprecation_notice_for_prometheus_service + return if !@service.is_a?(::PrometheusService) || !Feature.enabled?(:settings_operations_prometheus_service, project) + + operations_link_start = "<a href=\"#{project_settings_operations_path(project)}\">" + message = s_('PrometheusService|You can now manage your Prometheus settings on the %{operations_link_start}Operations%{operations_link_end} page. Fields on this page has been deprecated.') % { operations_link_start: operations_link_start, operations_link_end: "</a>" } + flash.now[:alert] = message.html_safe + end end diff --git a/app/services/concerns/akismet_methods.rb b/app/services/concerns/akismet_methods.rb index 48c4e329944..105b79785bd 100644 --- a/app/services/concerns/akismet_methods.rb +++ b/app/services/concerns/akismet_methods.rb @@ -9,7 +9,7 @@ module AkismetMethods @akismet ||= Spam::AkismetService.new( spammable_owner.name, spammable_owner.email, - spammable.spammable_text, + spammable.try(:spammable_text) || spammable&.text, options ) end diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb index 6cb84458d9b..b59bb803778 100644 --- a/app/services/issuable_base_service.rb +++ b/app/services/issuable_base_service.rb @@ -11,10 +11,14 @@ class IssuableBaseService < BaseService @skip_milestone_email = @params.delete(:skip_milestone_email) end - def filter_params(issuable) + def can_admin_issuable?(issuable) ability_name = :"admin_#{issuable.to_ability_name}" - unless can?(current_user, ability_name, issuable) + can?(current_user, ability_name, issuable) + end + + def filter_params(issuable) + unless can_admin_issuable?(issuable) params.delete(:milestone_id) params.delete(:labels) params.delete(:add_label_ids) diff --git a/app/services/spam/ham_service.rb b/app/services/spam/ham_service.rb index e8444ba8f93..d0f53eea90c 100644 --- a/app/services/spam/ham_service.rb +++ b/app/services/spam/ham_service.rb @@ -2,10 +2,17 @@ module Spam class HamService - attr_accessor :spam_log + include AkismetMethods + + attr_accessor :spam_log, :options def initialize(spam_log) @spam_log = spam_log + @user = spam_log.user + @options = { + ip_address: spam_log.source_ip, + user_agent: spam_log.user_agent + } end def execute @@ -16,17 +23,6 @@ module Spam end end - private - - def akismet - user = spam_log.user - @akismet ||= AkismetService.new( - user.name, - user.email, - spam_log.text, - ip_address: spam_log.source_ip, - user_agent: spam_log.user_agent - ) - end + alias_method :spammable, :spam_log end end diff --git a/app/workers/stuck_ci_jobs_worker.rb b/app/workers/stuck_ci_jobs_worker.rb index 7e3f7275b55..6e4ffa36854 100644 --- a/app/workers/stuck_ci_jobs_worker.rb +++ b/app/workers/stuck_ci_jobs_worker.rb @@ -2,7 +2,7 @@ class StuckCiJobsWorker include ApplicationWorker - include CronjobQueue # rubocop:disable Scalability/CronWorkerContext + include CronjobQueue feature_category :continuous_integration worker_resource_boundary :cpu @@ -56,13 +56,13 @@ class StuckCiJobsWorker loop do jobs = Ci::Build.where(status: status) .where(condition, timeout.ago) - .includes(:tags, :runner, project: :namespace) + .includes(:tags, :runner, project: [:namespace, :route]) .limit(100) .to_a break if jobs.empty? jobs.each do |job| - yield(job) + with_context(project: job.project) { yield(job) } end end end |