...@@ -188,6 +188,7 @@ module ProjectsHelper ...@@ -188,6 +188,7 @@ module ProjectsHelper
"cross-project:#{can?(current_user, :read_cross_project)}", "cross-project:#{can?(current_user, :read_cross_project)}",
max_project_member_access_cache_key(project), max_project_member_access_cache_key(project),
pipeline_status, pipeline_status,
Gitlab::I18n.locale,
'v2.6' 'v2.6'
] ]
... ...
......
...@@ -599,12 +599,6 @@ module Ci ...@@ -599,12 +599,6 @@ module Ci
project.notes.for_commit_id(sha) project.notes.for_commit_id(sha)
end end
# rubocop: disable CodeReuse/ServiceClass
def process!(trigger_build_ids = nil)
Ci::ProcessPipelineService.new(project, user).execute(self, trigger_build_ids)
end
# rubocop: enable CodeReuse/ServiceClass
def update_status def update_status
retry_optimistic_lock(self) do retry_optimistic_lock(self) do
new_status = latest_builds_status.to_s new_status = latest_builds_status.to_s
... ...
......
...@@ -23,7 +23,6 @@ module Issuable ...@@ -23,7 +23,6 @@ module Issuable
include Sortable include Sortable
include CreatedAtFilterable include CreatedAtFilterable
include UpdatedAtFilterable include UpdatedAtFilterable
include IssuableStates
include ClosedAtFilterable include ClosedAtFilterable
include VersionedDescription include VersionedDescription
... ...
......
# frozen_string_literal: true
module IssuableStates
extend ActiveSupport::Concern
# The state:string column is being migrated to state_id:integer column
# This is a temporary hook to keep state column in sync until it is removed.
# Check https: https://gitlab.com/gitlab-org/gitlab/issues/33814 for more information
# The state column can be safely removed after 2019-10-27
included do
before_save :sync_issuable_deprecated_state
end
def sync_issuable_deprecated_state
return if self.is_a?(Epic)
return unless respond_to?(:state)
return if state_id.nil?
deprecated_state = self.class.available_states.key(state_id)
self.write_attribute(:state, deprecated_state)
end
end
...@@ -66,7 +66,10 @@ class Issue < ApplicationRecord ...@@ -66,7 +66,10 @@ class Issue < ApplicationRecord
scope :public_only, -> { where(confidential: false) } scope :public_only, -> { where(confidential: false) }
scope :confidential_only, -> { where(confidential: true) } scope :confidential_only, -> { where(confidential: true) }
scope :counts_by_state, -> { reorder(nil).group(:state).count } scope :counts_by_state, -> { reorder(nil).group(:state_id).count }
# Only remove after 2019-12-22 and with %12.7
self.ignored_columns += %i[state]
after_commit :expire_etag_cache after_commit :expire_etag_cache
after_save :ensure_metrics, unless: :imported? after_save :ensure_metrics, unless: :imported?
... ...
......
...@@ -228,6 +228,9 @@ class MergeRequest < ApplicationRecord ...@@ -228,6 +228,9 @@ class MergeRequest < ApplicationRecord
with_state(:opened).where(auto_merge_enabled: true) with_state(:opened).where(auto_merge_enabled: true)
end end
# Only remove after 2019-12-22 and with %12.7
self.ignored_columns += %i[state]
after_save :keep_around_commit after_save :keep_around_commit
alias_attribute :project, :target_project alias_attribute :project, :target_project
... ...
......
...@@ -58,6 +58,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated ...@@ -58,6 +58,7 @@ class ReleasePresenter < Gitlab::View::Presenter::Delegated
end end
def release_edit_page_available? def release_edit_page_available?
::Feature.enabled?(:release_edit_page, project, default_enabled: true) ::Feature.enabled?(:release_edit_page, project, default_enabled: true) &&
can?(current_user, :update_release, release)
end end
end end
# frozen_string_literal: true # frozen_string_literal: true
class AnalyticsMergeRequestEntity < AnalyticsIssueEntity class AnalyticsMergeRequestEntity < AnalyticsIssueEntity
expose :state expose :state do |object|
MergeRequest.available_states.key(object[:state_id])
end
expose :url do |object| expose :url do |object|
url_to(:namespace_project_merge_request, object) url_to(:namespace_project_merge_request, object)
... ...
......
...@@ -57,7 +57,9 @@ module Ci ...@@ -57,7 +57,9 @@ module Ci
cancel_pending_pipelines if project.auto_cancel_pending_pipelines? cancel_pending_pipelines if project.auto_cancel_pending_pipelines?
pipeline_created_counter.increment(source: source) pipeline_created_counter.increment(source: source)
pipeline.process! Ci::ProcessPipelineService
.new(pipeline)
.execute
end end
end end
... ...
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class ProcessPipelineService < BaseService class ProcessPipelineService
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
attr_reader :pipeline attr_reader :pipeline
def execute(pipeline, trigger_build_ids = nil) def initialize(pipeline)
@pipeline = pipeline @pipeline = pipeline
end
def execute(trigger_build_ids = nil)
update_retried update_retried
success = process_stages_without_needs success = process_stages_without_needs
...@@ -72,7 +74,7 @@ module Ci ...@@ -72,7 +74,7 @@ module Ci
def process_build(build, current_status) def process_build(build, current_status)
Gitlab::OptimisticLocking.retry_lock(build) do |subject| Gitlab::OptimisticLocking.retry_lock(build) do |subject|
Ci::ProcessBuildService.new(project, @user) Ci::ProcessBuildService.new(project, build.user)
.execute(subject, current_status) .execute(subject, current_status)
end end
end end
...@@ -129,5 +131,9 @@ module Ci ...@@ -129,5 +131,9 @@ module Ci
.update_all(retried: true) if latest_statuses.any? .update_all(retried: true) if latest_statuses.any?
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
def project
pipeline.project
end
end end
end end
...@@ -24,7 +24,9 @@ module Ci ...@@ -24,7 +24,9 @@ module Ci
.new(project, current_user) .new(project, current_user)
.close_all(pipeline) .close_all(pipeline)
pipeline.process! Ci::ProcessPipelineService
.new(pipeline)
.execute
end end
end end
end end
...@@ -397,7 +397,7 @@ class IssuableBaseService < BaseService ...@@ -397,7 +397,7 @@ class IssuableBaseService < BaseService
end end
def update_project_counter_caches?(issuable) def update_project_counter_caches?(issuable)
issuable.state_changed? issuable.state_id_changed?
end end
def parent def parent
... ...
......
...@@ -11,7 +11,9 @@ class PipelineProcessWorker ...@@ -11,7 +11,9 @@ class PipelineProcessWorker
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def perform(pipeline_id, build_ids = nil) def perform(pipeline_id, build_ids = nil)
Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline| Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline|
pipeline.process!(build_ids) Ci::ProcessPipelineService
.new(pipeline)
.execute(build_ids)
end end
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
... ...
......
---
title: Creates DB tables for storing mentioned users, groups, projects referenced
in a note or issuable description
merge_request: 18316
author:
type: added
---
title: Add link color to design comments
merge_request: 20302
author:
type: fixed
---
title: Remove Release edit url for users not allowed to update a release
merge_request: 20136
author:
type: fixed
---
title: Fix projects list to show info in user's locale
merge_request: 20015
author: Arun Kumar Mohan
type: fixed
...@@ -93,7 +93,7 @@ tables: ...@@ -93,7 +93,7 @@ tables:
- updated_at - updated_at
- description - description
- milestone_id - milestone_id
- state - state_id
- updated_by_id - updated_by_id
- weight - weight
- due_date - due_date
...@@ -174,7 +174,7 @@ tables: ...@@ -174,7 +174,7 @@ tables:
- created_at - created_at
- updated_at - updated_at
- milestone_id - milestone_id
- state - state_id
- merge_status - merge_status
- target_project_id - target_project_id
- updated_by_id - updated_by_id
... ...
......
# frozen_string_literal: true
class CreateIssueUserMentions < ActiveRecord::Migration[5.2]
DOWNTIME = false
def change
create_table :issue_user_mentions do |t|
t.references :issue, type: :integer, index: false, null: false, foreign_key: { on_delete: :cascade }
t.references :note, type: :integer,
index: { where: 'note_id IS NOT NULL', unique: true }, null: true, foreign_key: { on_delete: :cascade }
t.integer :mentioned_users_ids, array: true
t.integer :mentioned_projects_ids, array: true
t.integer :mentioned_groups_ids, array: true
end
add_index :issue_user_mentions, [:issue_id], where: 'note_id is null', unique: true, name: 'issue_user_mentions_on_issue_id_index'
add_index :issue_user_mentions, [:issue_id, :note_id], unique: true, name: 'issue_user_mentions_on_issue_id_and_note_id_index'
end
end
# frozen_string_literal: true
class CreateMergeRequestUserMentions < ActiveRecord::Migration[5.2]
DOWNTIME = false
def change
create_table :merge_request_user_mentions do |t|
t.references :merge_request, type: :integer, index: false, null: false, foreign_key: { on_delete: :cascade }
t.references :note, type: :integer,
index: { where: 'note_id IS NOT NULL', unique: true }, null: true, foreign_key: { on_delete: :cascade }
t.integer :mentioned_users_ids, array: true
t.integer :mentioned_projects_ids, array: true
t.integer :mentioned_groups_ids, array: true
end
add_index :merge_request_user_mentions, [:merge_request_id], where: 'note_id is null', unique: true, name: 'merge_request_user_mentions_on_mr_id_index'
add_index :merge_request_user_mentions, [:merge_request_id, :note_id], unique: true, name: 'merge_request_user_mentions_on_mr_id_and_note_id_index'
end
end