Skip to content
Snippets Groups Projects
Commit 80f61b40 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 4ab54c22
No related branches found
No related tags found
No related merge requests found
Showing
with 25 additions and 26 deletions
Loading
Loading
@@ -22,7 +22,7 @@ class Snippet < ApplicationRecord
redact_field :description
 
# Aliases to make application_helper#edited_time_ago_with_tooltip helper work properly with snippets.
# See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10392/diffs#note_28719102
# See https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/10392/diffs#note_28719102
alias_attribute :last_edited_at, :updated_at
alias_attribute :last_edited_by, :updated_by
 
Loading
Loading
Loading
Loading
@@ -89,11 +89,12 @@ class Todo < ApplicationRecord
])
end
 
# Returns `true` if the current user has any todos for the given target.
# Returns `true` if the current user has any todos for the given target with the optional given state.
#
# target - The value of the `target_type` column, such as `Issue`.
def any_for_target?(target)
exists?(target: target)
# state - The value of the `state` column, such as `pending` or `done`.
def any_for_target?(target, state = nil)
state.nil? ? exists?(target: target) : exists?(target: target, state: state)
end
 
# Updates the state of a relation of todos to the new state.
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ module UserCalloutEnums
# extended by EE.
#
# If you are going to add new items to this hash, check that you're not going
# to conflict with EE-only values: https://gitlab.com/gitlab-org/gitlab-ee/blob/master/ee/app/models/ee/user_callout_enums.rb
# to conflict with EE-only values: https://gitlab.com/gitlab-org/gitlab/blob/master/ee/app/models/ee/user_callout_enums.rb
def self.feature_names
{
gke_cluster_integration: 1,
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ class ProjectSnippetPolicy < BasePolicy
condition(:is_author) { @user && @subject.author == @user }
 
# We have to check both project feature visibility and a snippet visibility and take the stricter one
# This will be simplified - check https://gitlab.com/gitlab-org/gitlab-ce/issues/27573
# This will be simplified - check https://gitlab.com/gitlab-org/gitlab-foss/issues/27573
rule { ~can?(:read_project) }.policy do
prevent :read_project_snippet
prevent :update_project_snippet
Loading
Loading
Loading
Loading
@@ -24,7 +24,7 @@ Presenters should be used for:
 
- Data and logic methods that can be pulled & combined into single methods from
view. This can include loops extracted from views too. A good example is
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7073/diffs.
https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/7073/diffs.
- Data and logic methods that can be pulled from models.
- Simple text output methods: it's ok if the method returns a string, but not a
whole DOM element for which we'd need HAML, a view context, helpers etc.
Loading
Loading
Loading
Loading
@@ -317,9 +317,9 @@ MyObjectSerializer.new.represent(object.present)
[grape-entity-readme]: https://github.com/ruby-grape/grape-entity/blob/master/README.md
[grape-entity-class]: https://github.com/ruby-grape/grape-entity/blob/master/lib/grape_entity/entity.rb
[grape-entity-only]: https://github.com/ruby-grape/grape-entity/blob/master/README.md#returning-only-the-fields-you-want
[presenters-readme]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/presenters/README.md
[presenters-readme]: https://gitlab.com/gitlab-org/gitlab-foss/blob/master/app/presenters/README.md
[fluent-interface]: https://en.wikipedia.org/wiki/Fluent_interface
[json-schema-gem]: https://github.com/ruby-json-schema/json-schema
[issue-20045]: https://gitlab.com/gitlab-org/gitlab-ce/issues/20045
[issue-30898]: https://gitlab.com/gitlab-org/gitlab-ce/issues/30898
[issue-27569]: https://gitlab.com/gitlab-org/gitlab-ce/issues/27569
[issue-20045]: https://gitlab.com/gitlab-org/gitlab-foss/issues/20045
[issue-30898]: https://gitlab.com/gitlab-org/gitlab-foss/issues/30898
[issue-27569]: https://gitlab.com/gitlab-org/gitlab-foss/issues/27569
Loading
Loading
@@ -55,7 +55,7 @@ module EntityDateHelper
is_upcoming = (due_date - Date.today).to_i > 0
time_ago = distance_of_time_in_words(due_date, Date.today)
 
# https://gitlab.com/gitlab-org/gitlab-ce/issues/49440
# https://gitlab.com/gitlab-org/gitlab-foss/issues/49440
#
# Need to improve the i18n here and do a full translation
# of the string instead of piecewise translations.
Loading
Loading
Loading
Loading
@@ -80,7 +80,7 @@ class MergeRequestPollCachedWidgetEntity < IssuableEntity
 
# Once SchedulePopulateMergeRequestMetricsWithEventsData fully runs,
# we can remove this method and just serialize MergeRequest#metrics
# instead. See https://gitlab.com/gitlab-org/gitlab-ce/issues/41587
# instead. See https://gitlab.com/gitlab-org/gitlab-foss/issues/41587
def build_metrics(merge_request)
# There's no need to query and serialize metrics data for merge requests that are not
# merged or closed.
Loading
Loading
Loading
Loading
@@ -43,7 +43,7 @@ class AccessTokenValidationService
# We're comparing each required_scope against all token scopes, which would
# take quadratic time. This consideration is irrelevant here because of the
# small number of records involved.
# https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12300/#note_33689006
# https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/12300/#note_33689006
token_scopes = token.scopes.map(&:to_sym)
 
required_scopes.any? do |scope|
Loading
Loading
Loading
Loading
@@ -6,7 +6,7 @@ module Applications
 
def initialize(current_user, params)
@current_user = current_user
@params = params.except(:ip_address) # rubocop: disable CodeReuse/ActiveRecord
@params = params.except(:ip_address)
end
 
# EE would override and use `request` arg
Loading
Loading
Loading
Loading
@@ -177,7 +177,7 @@ module Auth
# We still support legacy pipeline triggers which do not have associated
# actor. New permissions model and new triggers are always associated with
# an actor. So this should be improved once
# https://gitlab.com/gitlab-org/gitlab-ce/issues/37452 is resolved.
# https://gitlab.com/gitlab-org/gitlab-foss/issues/37452 is resolved.
#
def build_can_push?(requested_project)
# Build can push only to the project from which it originates
Loading
Loading
Loading
Loading
@@ -48,7 +48,7 @@ module Ci
 
Gitlab::Sentry
.track_exception(error,
issue_url: 'https://gitlab.com/gitlab-org/gitlab-ce/issues/51502',
issue_url: 'https://gitlab.com/gitlab-org/gitlab-foss/issues/51502',
extra: { job_id: job.id })
end
end
Loading
Loading
Loading
Loading
@@ -94,7 +94,7 @@ module Ci
 
# rubocop: disable CodeReuse/ActiveRecord
def auto_cancelable_pipelines
# TODO: Introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23464
# TODO: Introduced by https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/23464
if Feature.enabled?(:ci_support_interruptible_pipelines, project, default_enabled: true)
project.ci_pipelines
.where(ref: pipeline.ref)
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ module Ci
ensure
##
# This is the temporary solution for avoiding the memory bloat.
# See more https://gitlab.com/gitlab-org/gitlab-ce/issues/61955
# See more https://gitlab.com/gitlab-org/gitlab-foss/issues/61955
GC.start if Feature.enabled?(:ci_pipeline_schedule_force_gc, default_enabled: true)
end
end
Loading
Loading
Loading
Loading
@@ -115,7 +115,7 @@ module Git
 
# It's not sufficient to just check for a blank SHA as it's possible for the
# branch to be pushed, but for the `post-receive` hook to never run:
# https://gitlab.com/gitlab-org/gitlab-ce/issues/59257
# https://gitlab.com/gitlab-org/gitlab-foss/issues/59257
def creating_branch?
strong_memoize(:creating_branch) do
Gitlab::Git.blank_ref?(params[:oldrev]) ||
Loading
Loading
Loading
Loading
@@ -45,11 +45,9 @@ module Issuable
original_entity.resource_label_events.find_in_batches do |batch|
events = batch.map do |event|
entity_key = new_entity.is_a?(Issue) ? 'issue_id' : 'epic_id'
# rubocop: disable CodeReuse/ActiveRecord
event.attributes
.except('id', 'reference', 'reference_html')
.merge(entity_key => new_entity.id, 'action' => ResourceLabelEvent.actions[event.action])
# rubocop: enable CodeReuse/ActiveRecord
end
 
Gitlab::Database.bulk_insert(ResourceLabelEvent.table_name, events)
Loading
Loading
Loading
Loading
@@ -41,7 +41,7 @@ module Issuable
create_task_status_note
else
# TODO: Show this note if non-task content was modified.
# https://gitlab.com/gitlab-org/gitlab-ce/issues/33577
# https://gitlab.com/gitlab-org/gitlab-foss/issues/33577
create_description_change_note
end
end
Loading
Loading
Loading
Loading
@@ -77,7 +77,7 @@ module Labels
# in the project being transferred.
# IDs are fetched in a separate query because MySQL doesn't
# allow referring of 'label_links' table in UPDATE query:
# https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/62435068
# https://gitlab.com/gitlab-org/gitlab-foss/-/jobs/62435068
link_ids = labels.pluck('label_links.id')
 
LabelLink.where(id: link_ids, label_id: old_label_id)
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ module MergeRequests
@params_issue_iid = params.delete(:issue_iid)
self.merge_request = MergeRequest.new
# TODO: this should handle all quick actions that don't have side effects
# https://gitlab.com/gitlab-org/gitlab-ce/issues/53658
# https://gitlab.com/gitlab-org/gitlab-foss/issues/53658
merge_quick_actions_into_params!(merge_request, only: [:target_branch])
merge_request.merge_params['force_remove_source_branch'] = params.delete(:force_remove_source_branch) if params.has_key?(:force_remove_source_branch)
 
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@ module MergeRequests
private
 
def refresh_merge_requests!
# n + 1: https://gitlab.com/gitlab-org/gitlab-ce/issues/60289
# n + 1: https://gitlab.com/gitlab-org/gitlab-foss/issues/60289
Gitlab::GitalyClient.allow_n_plus_1_calls(&method(:find_new_commits))
 
# Be sure to close outstanding MRs before reloading them to avoid generating an
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment