Skip to content

Commit fd9a56d

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 552e85a commit fd9a56d

File tree

74 files changed

+800
-507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+800
-507
lines changed

.gitlab/CODEOWNERS

+5-4
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab
645645
/doc/api/templates/licenses.md @rdickenson
646646
/doc/api/todos.md @msedlakjakubowski
647647
/doc/api/topics.md @lciutacu
648-
/doc/api/usage_data.md @dianalogan
648+
/doc/api/usage_data.md @lciutacu
649649
/doc/api/users.md @jglassman1
650650
/doc/api/version.md @phillipwells
651651
/doc/api/visual_review_discussions.md @drcatherinepope
@@ -767,8 +767,8 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab
767767
/doc/development/sec/ @rdickenson
768768
/doc/development/sec/security_report_ingestion_overview.md @dianalogan
769769
/doc/development/secure_coding_guidelines.md @sselhorn
770-
/doc/development/service_ping/ @dianalogan
771-
/doc/development/snowplow/ @dianalogan
770+
/doc/development/service_ping/ @lciutacu
771+
/doc/development/snowplow/ @lciutacu
772772
/doc/development/spam_protection_and_captcha/ @phillipwells
773773
/doc/development/sql.md @aqualls
774774
/doc/development/testing_guide/ @sselhorn
@@ -864,11 +864,12 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab
864864
/doc/user/admin_area/settings/rate_limit_on_issues_creation.md @msedlakjakubowski
865865
/doc/user/admin_area/settings/rate_limit_on_notes_creation.md @msedlakjakubowski
866866
/doc/user/admin_area/settings/rate_limit_on_pipelines_creation.md @drcatherinepope
867+
/doc/user/admin_area/settings/rate_limit_on_projects_api.md @lciutacu
867868
/doc/user/admin_area/settings/rate_limit_on_users_api.md @jglassman1
868869
/doc/user/admin_area/settings/scim_setup.md @jglassman1
869870
/doc/user/admin_area/settings/terraform_limits.md @phillipwells
870871
/doc/user/admin_area/settings/third_party_offers.md @lciutacu
871-
/doc/user/admin_area/settings/usage_statistics.md @dianalogan
872+
/doc/user/admin_area/settings/usage_statistics.md @lciutacu
872873
/doc/user/admin_area/settings/visibility_and_access_controls.md @aqualls
873874
/doc/user/analytics/ @lciutacu
874875
/doc/user/analytics/ci_cd_analytics.md @rdickenson

.rubocop_todo/rails/inverse_of.yml

-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
---
22
Rails/InverseOf:
33
Exclude:
4-
- 'app/models/alert_management/alert.rb'
5-
- 'app/models/alert_management/alert_assignee.rb'
6-
- 'app/models/application_setting.rb'
7-
- 'app/models/audit_event.rb'
8-
- 'app/models/board.rb'
9-
- 'app/models/bulk_imports/entity.rb'
10-
- 'app/models/bulk_imports/tracker.rb'
114
- 'app/models/ci/build.rb'
125
- 'app/models/ci/build_pending_state.rb'
136
- 'app/models/ci/build_trace_chunk.rb'

app/assets/javascripts/search/sidebar/components/app.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export default {
2727
</script>
2828

2929
<template>
30-
<section class="search-sidebar gl-display-flex gl-flex-direction-column gl-mr-4 gl-mb-6 gl-mt-5">
30+
<section
31+
class="search-sidebar gl-display-flex gl-flex-direction-column gl-md-mr-5 gl-mb-6 gl-mt-5"
32+
>
3133
<scope-navigation />
3234
<results-filters v-if="showIssueAndMergeFilters" />
3335
<language-filter v-if="showBlobFilter" />

app/assets/javascripts/search/topbar/components/app.vue

+42-37
Original file line numberDiff line numberDiff line change
@@ -86,45 +86,50 @@ export default {
8686
</script>
8787

8888
<template>
89-
<section class="search-page-form gl-lg-display-flex gl-flex-direction-column">
90-
<div class="gl-lg-display-flex gl-flex-direction-row gl-align-items-flex-end">
91-
<div class="gl-flex-grow-1 gl-mb-4 gl-lg-mb-0 gl-lg-mr-2">
92-
<div
93-
class="gl-sm-display-flex gl-flex-direction-row gl-justify-content-space-between gl-mb-4 gl-md-mb-0"
94-
>
95-
<label>{{ $options.i18n.searchLabel }}</label>
96-
<template v-if="showSyntaxOptions">
97-
<gl-button
98-
category="tertiary"
99-
variant="link"
100-
size="small"
101-
button-text-classes="gl-font-sm!"
102-
@click="onToggleDrawer"
103-
>{{ $options.i18n.syntaxOptionsLabel }}
104-
</gl-button>
105-
<markdown-drawer
106-
ref="markdownDrawer"
107-
:document-path="$options.SYNTAX_OPTIONS_DOCUMENT"
108-
/>
109-
</template>
89+
<section class="gl-p-5 gl-bg-gray-10 gl-border-b">
90+
<div class="search-page-form gl-lg-display-flex gl-flex-direction-column">
91+
<div class="gl-lg-display-flex gl-flex-direction-row gl-align-items-flex-end">
92+
<div class="gl-flex-grow-1 gl-mb-4 gl-lg-mb-0 gl-lg-mr-2">
93+
<div
94+
class="gl-display-flex gl-flex-direction-row gl-justify-content-space-between gl-mb-0 gl-md-mb-4"
95+
>
96+
<label class="gl-mb-1 gl-md-pb-2">{{ $options.i18n.searchLabel }}</label>
97+
<template v-if="showSyntaxOptions">
98+
<gl-button
99+
category="tertiary"
100+
variant="link"
101+
size="small"
102+
button-text-classes="gl-font-sm!"
103+
@click="onToggleDrawer"
104+
>{{ $options.i18n.syntaxOptionsLabel }}
105+
</gl-button>
106+
<markdown-drawer
107+
ref="markdownDrawer"
108+
:document-path="$options.SYNTAX_OPTIONS_DOCUMENT"
109+
/>
110+
</template>
111+
</div>
112+
<gl-search-box-by-click
113+
id="dashboard_search"
114+
v-model="search"
115+
name="search"
116+
:placeholder="$options.i18n.searchPlaceholder"
117+
@submit="applyQuery"
118+
/>
119+
</div>
120+
<div v-if="showFilters" class="gl-mb-4 gl-lg-mb-0 gl-lg-mx-3">
121+
<label class="gl-display-block gl-mb-1 gl-md-pb-2">{{
122+
$options.i18n.groupFieldLabel
123+
}}</label>
124+
<group-filter :initial-data="groupInitialJson" />
125+
</div>
126+
<div v-if="showFilters" class="gl-mb-4 gl-lg-mb-0 gl-lg-ml-3">
127+
<label class="gl-display-block gl-mb-1 gl-md-pb-2">{{
128+
$options.i18n.projectFieldLabel
129+
}}</label>
130+
<project-filter :initial-data="projectInitialJson" />
110131
</div>
111-
<gl-search-box-by-click
112-
id="dashboard_search"
113-
v-model="search"
114-
name="search"
115-
:placeholder="$options.i18n.searchPlaceholder"
116-
@submit="applyQuery"
117-
/>
118-
</div>
119-
<div v-if="showFilters" class="gl-mb-4 gl-lg-mb-0 gl-lg-mx-3">
120-
<label class="gl-display-block">{{ $options.i18n.groupFieldLabel }}</label>
121-
<group-filter :initial-data="groupInitialJson" />
122-
</div>
123-
<div v-if="showFilters" class="gl-mb-4 gl-lg-mb-0 gl-lg-ml-3">
124-
<label class="gl-display-block">{{ $options.i18n.projectFieldLabel }}</label>
125-
<project-filter :initial-data="projectInitialJson" />
126132
</div>
127133
</div>
128-
<hr class="gl-mt-5 gl-mb-0 gl-border-gray-100" />
129134
</section>
130135
</template>

app/controllers/application_controller.rb

-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class ApplicationController < ActionController::Base
3333
before_action :check_password_expiration, if: :html_request?
3434
before_action :ldap_security_check
3535
before_action :default_headers
36-
before_action :default_cache_headers
3736
before_action :add_gon_variables, if: :html_request?
3837
before_action :configure_permitted_parameters, if: :devise_controller?
3938
before_action :require_email, unless: :devise_controller?
@@ -316,10 +315,6 @@ def default_headers
316315
headers['X-Content-Type-Options'] = 'nosniff'
317316
end
318317

319-
def default_cache_headers
320-
headers['Pragma'] = 'no-cache' # HTTP 1.0 compatibility
321-
end
322-
323318
def stream_csv_headers(csv_filename)
324319
no_cache_headers
325320
stream_headers

app/controllers/concerns/uploads_actions.rb

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ module UploadsActions
99

1010
included do
1111
prepend_before_action :set_request_format_from_path_extension
12-
skip_before_action :default_cache_headers, only: :show
1312
rescue_from FileUploader::InvalidSecret, with: :render_404
1413
end
1514

app/controllers/projects/avatars_controller.rb

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
class Projects::AvatarsController < Projects::ApplicationController
44
include SendsBlob
55

6-
skip_before_action :default_cache_headers, only: :show
7-
86
before_action :authorize_admin_project!, only: [:destroy]
97

108
feature_category :projects

app/controllers/projects/design_management/designs/raw_images_controller.rb

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ module Designs
77
class RawImagesController < Projects::DesignManagement::DesignsController
88
include SendsBlob
99

10-
skip_before_action :default_cache_headers, only: :show
11-
1210
def show
1311
blob = design_repository.blob_at(ref, design.full_path)
1412

app/controllers/projects/design_management/designs/resized_image_controller.rb

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ class ResizedImageController < Projects::DesignManagement::DesignsController
1010
before_action :validate_size!
1111
before_action :validate_sha!
1212

13-
skip_before_action :default_cache_headers, only: :show
14-
1513
def show
1614
relation = design.actions
1715
relation = relation.up_to_version(version) if version

app/controllers/projects/raw_controller.rb

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ class Projects::RawController < Projects::ApplicationController
66
include SendsBlob
77
include StaticObjectExternalStorage
88

9-
skip_before_action :default_cache_headers, only: :show
10-
119
prepend_before_action(only: [:show]) { authenticate_sessionless_user!(:blob) }
1210

1311
before_action :assign_ref_vars

app/controllers/projects/repositories_controller.rb

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ class Projects::RepositoriesController < Projects::ApplicationController
88

99
prepend_before_action(only: [:archive]) { authenticate_sessionless_user!(:archive) }
1010

11-
skip_before_action :default_cache_headers, only: :archive
12-
1311
# Authorize
1412
before_action :check_archive_rate_limiting!, only: :archive
1513
before_action :require_non_empty_project, except: :create

app/controllers/search_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def self.search_rate_limited_endpoints
2424

2525
before_action :block_anonymous_global_searches, :check_scope_global_search_enabled, except: :opensearch
2626
skip_before_action :authenticate_user!
27-
skip_before_action :default_cache_headers, only: [:count, :autocomplete]
2827

2928
requires_cross_project_access if: -> do
3029
search_term_present = params[:search].present? || params[:term].present?

app/models/alert_management/alert.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ class Alert < ApplicationRecord
2525
has_many :assignees, through: :alert_assignees
2626

2727
has_many :notes, as: :noteable, inverse_of: :noteable, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
28-
has_many :ordered_notes, -> { fresh }, as: :noteable, class_name: 'Note'
29-
has_many :user_mentions, class_name: 'AlertManagement::AlertUserMention', foreign_key: :alert_management_alert_id
28+
has_many :ordered_notes, -> { fresh }, as: :noteable, class_name: 'Note', inverse_of: :noteable
29+
has_many :user_mentions, class_name: 'AlertManagement::AlertUserMention', foreign_key: :alert_management_alert_id,
30+
inverse_of: :alert
3031
has_many :metric_images, class_name: '::AlertManagement::MetricImage'
3132

3233
has_internal_id :iid, scope: :project

app/models/alert_management/alert_assignee.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module AlertManagement
44
class AlertAssignee < ApplicationRecord
55
belongs_to :alert, inverse_of: :alert_assignees
6-
belongs_to :assignee, class_name: 'User', foreign_key: :user_id
6+
belongs_to :assignee, class_name: 'User', foreign_key: :user_id, inverse_of: :alert_assignees
77

88
validates :alert, presence: true
99
validates :assignee, presence: true, uniqueness: { scope: :alert_id }

app/models/alert_management/alert_user_mention.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
module AlertManagement
44
class AlertUserMention < UserMention
5-
belongs_to :alert_management_alert, class_name: '::AlertManagement::Alert'
5+
belongs_to :alert, class_name: '::AlertManagement::Alert',
6+
foreign_key: :alert_management_alert_id,
7+
inverse_of: :user_mentions
8+
69
belongs_to :note
710
end
811
end

app/models/application_setting.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ class ApplicationSetting < MainClusterwide::ApplicationRecord
3030
add_authentication_token_field :static_objects_external_storage_auth_token, encrypted: :required
3131
add_authentication_token_field :error_tracking_access_token, encrypted: :required
3232

33-
belongs_to :self_monitoring_project, class_name: "Project", foreign_key: 'instance_administration_project_id'
33+
belongs_to :self_monitoring_project, class_name: "Project", foreign_key: :instance_administration_project_id,
34+
inverse_of: :application_setting
3435
belongs_to :push_rule
3536
alias_attribute :self_monitoring_project_id, :instance_administration_project_id
3637

37-
belongs_to :instance_group, class_name: "Group", foreign_key: 'instance_administrators_group_id'
38+
belongs_to :instance_group, class_name: "Group", foreign_key: :instance_administrators_group_id,
39+
inverse_of: :application_setting
3840
alias_attribute :instance_group_id, :instance_administrators_group_id
3941
alias_attribute :instance_administrators_group, :instance_group
4042
alias_attribute :housekeeping_optimize_repository_period, :housekeeping_incremental_repack_period

app/models/audit_event.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AuditEvent < ApplicationRecord
2121

2222
serialize :details, Hash # rubocop:disable Cop/ActiveRecordSerialize
2323

24-
belongs_to :user, foreign_key: :author_id
24+
belongs_to :user, foreign_key: :author_id, inverse_of: :audit_events
2525

2626
validates :author_id, presence: true
2727
validates :entity_id, presence: true

app/models/board.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ class Board < ApplicationRecord
66
belongs_to :group
77
belongs_to :project
88

9-
has_many :lists, -> { ordered }, dependent: :delete_all # rubocop:disable Cop/ActiveRecordDependent
10-
has_many :destroyable_lists, -> { destroyable.ordered }, class_name: "List"
9+
has_many :lists, -> { ordered }, dependent: :delete_all, inverse_of: :board # rubocop:disable Cop/ActiveRecordDependent
10+
has_many :destroyable_lists, -> { destroyable.ordered }, class_name: "List", inverse_of: :board
1111

1212
validates :name, presence: true
1313
validates :project, presence: true, if: :project_needed?

app/models/bulk_imports/entity.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ class BulkImports::Entity < ApplicationRecord
2626
belongs_to :parent, class_name: 'BulkImports::Entity', optional: true
2727

2828
belongs_to :project, optional: true
29-
belongs_to :group, foreign_key: :namespace_id, optional: true
29+
belongs_to :group, foreign_key: :namespace_id, optional: true, inverse_of: :bulk_import_entities
3030

3131
has_many :trackers,
3232
class_name: 'BulkImports::Tracker',
33+
inverse_of: :entity,
3334
foreign_key: :bulk_import_entity_id
3435

3536
has_many :failures,

app/models/bulk_imports/tracker.rb

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class BulkImports::Tracker < ApplicationRecord
77

88
belongs_to :entity,
99
class_name: 'BulkImports::Entity',
10+
inverse_of: :trackers,
1011
foreign_key: :bulk_import_entity_id,
1112
optional: false
1213

app/models/group.rb

+3
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ def of_ancestors_and_self
110110

111111
has_one :import_state, class_name: 'GroupImportState', inverse_of: :group
112112

113+
has_many :application_setting, foreign_key: :instance_administrators_group_id, inverse_of: :instance_group
114+
113115
has_many :bulk_import_exports, class_name: 'BulkImports::Export', inverse_of: :group
116+
has_many :bulk_import_entities, class_name: 'BulkImports::Entity', foreign_key: :namespace_id, inverse_of: :group
114117

115118
has_many :group_deploy_keys_groups, inverse_of: :group
116119
has_many :group_deploy_keys, through: :group_deploy_keys_groups

app/models/project.rb

+2
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ class Project < ApplicationRecord
167167
has_one :last_event, -> { order 'events.created_at DESC' }, class_name: 'Event'
168168
has_many :boards
169169

170+
has_many :application_setting, inverse_of: :self_monitoring_project
171+
170172
def self.integration_association_name(name)
171173
"#{name}_integration"
172174
end

app/models/user.rb

+2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ def update_tracked_fields!(request)
228228
has_many :notification_settings
229229
has_many :award_emoji, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
230230
has_many :triggers, class_name: 'Ci::Trigger', foreign_key: :owner_id
231+
has_many :audit_events, foreign_key: :author_id, inverse_of: :user
231232

233+
has_many :alert_assignees, class_name: '::AlertManagement::AlertAssignee', inverse_of: :assignee
232234
has_many :issue_assignees, inverse_of: :assignee
233235
has_many :merge_request_assignees, inverse_of: :assignee, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
234236
has_many :merge_request_reviewers, inverse_of: :reviewer, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent

app/services/packages/mark_package_for_destruction_service.rb

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def execute
1313
package.sync_maven_metadata(current_user)
1414

1515
service_response_success('Package was successfully marked as pending destruction')
16-
rescue StandardError
16+
rescue StandardError => e
17+
track_exception(e)
1718
service_response_error('Failed to mark the package as pending destruction', 400)
1819
end
1920

@@ -30,5 +31,13 @@ def service_response_success(message)
3031
def user_can_delete_package?
3132
can?(current_user, :destroy_package, package.project)
3233
end
34+
35+
def track_exception(error)
36+
Gitlab::ErrorTracking.track_exception(
37+
error,
38+
project_id: package.project_id,
39+
package_id: package.id
40+
)
41+
end
3342
end
3443
end

0 commit comments

Comments
 (0)