Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-08 21:08:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-08 21:08:59 +0300
commit8b0d3151ae81cef695647771d1781c535d6f6cf5 (patch)
treef58d72ada21f6f7598a1e9f69fc80cdbbae8f2b6 /app
parentec9dd96cd876d8778bb757a1e1e0252a58fdcbbb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/images/auth_buttons/shibboleth_64.pngbin0 -> 2993 bytes
-rw-r--r--app/controllers/graphql_controller.rb14
-rw-r--r--app/graphql/graphql_triggers.rb8
-rw-r--r--app/graphql/subscriptions/work_item_updated.rb21
-rw-r--r--app/graphql/types/global_id_type.rb6
-rw-r--r--app/graphql/types/subscription_type.rb5
-rw-r--r--app/helpers/auth_helper.rb1
-rw-r--r--app/models/plan_limits.rb1
-rw-r--r--app/services/issues/update_service.rb7
-rw-r--r--app/services/work_items/update_service.rb1
10 files changed, 63 insertions, 1 deletions
diff --git a/app/assets/images/auth_buttons/shibboleth_64.png b/app/assets/images/auth_buttons/shibboleth_64.png
new file mode 100644
index 00000000000..d4c752f9400
--- /dev/null
+++ b/app/assets/images/auth_buttons/shibboleth_64.png
Binary files differ
diff --git a/app/controllers/graphql_controller.rb b/app/controllers/graphql_controller.rb
index 617a8aa1508..f8967cf023f 100644
--- a/app/controllers/graphql_controller.rb
+++ b/app/controllers/graphql_controller.rb
@@ -270,6 +270,8 @@ class GraphqlController < ApplicationController
def execute_introspection_query
if introspection_query_can_use_cache?
+ log_introspection_query_message(true)
+
# Context for caching: https://gitlab.com/gitlab-org/gitlab/-/issues/409448
Rails.cache.fetch(
introspection_query_cache_key,
@@ -277,6 +279,8 @@ class GraphqlController < ApplicationController
execute_query.to_json
end
else
+ log_introspection_query_message(false)
+
execute_query
end
end
@@ -293,4 +297,14 @@ class GraphqlController < ApplicationController
# https://gitlab.com/gitlab-org/gitlab/-/issues/409448#note_1377558096
['introspection-query-cache', Gitlab.revision, context[:remove_deprecated]]
end
+
+ def log_introspection_query_message(can_use_introspection_query_cache)
+ Gitlab::AppLogger.info(
+ message: "IntrospectionQueryCache",
+ can_use_introspection_query_cache: can_use_introspection_query_cache,
+ query: query,
+ variables: build_variables(params[:variables]),
+ introspection_query_cache_key: introspection_query_cache_key
+ )
+ end
end
diff --git a/app/graphql/graphql_triggers.rb b/app/graphql/graphql_triggers.rb
index d1798d2ade7..7abd1258958 100644
--- a/app/graphql/graphql_triggers.rb
+++ b/app/graphql/graphql_triggers.rb
@@ -60,6 +60,14 @@ module GraphqlTriggers
:merge_request_approval_state_updated, { issuable_id: merge_request.to_gid }, merge_request
)
end
+
+ def self.work_item_updated(work_item)
+ # becomes is necessary here since this can be triggered with both a WorkItem and also an Issue
+ # depending on the update service the call comes from
+ work_item = work_item.becomes(::WorkItem) if work_item.is_a?(::Issue) # rubocop:disable Cop/AvoidBecomes
+
+ ::GitlabSchema.subscriptions.trigger('workItemUpdated', { work_item_id: work_item.to_gid }, work_item)
+ end
end
GraphqlTriggers.prepend_mod
diff --git a/app/graphql/subscriptions/work_item_updated.rb b/app/graphql/subscriptions/work_item_updated.rb
new file mode 100644
index 00000000000..f7bb8372e50
--- /dev/null
+++ b/app/graphql/subscriptions/work_item_updated.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+module Subscriptions
+ class WorkItemUpdated < BaseSubscription
+ include Gitlab::Graphql::Laziness
+
+ payload_type Types::WorkItemType
+
+ argument :work_item_id, Types::GlobalIDType[WorkItem],
+ required: true,
+ description: 'ID of the work item.'
+
+ def authorized?(work_item_id:)
+ work_item = force(GitlabSchema.find_by_gid(work_item_id))
+
+ unauthorized! unless work_item && Ability.allowed?(current_user, :"read_#{work_item.to_ability_name}", work_item)
+
+ true
+ end
+ end
+end
diff --git a/app/graphql/types/global_id_type.rb b/app/graphql/types/global_id_type.rb
index 7ebd98ff2e7..295a20c645e 100644
--- a/app/graphql/types/global_id_type.rb
+++ b/app/graphql/types/global_id_type.rb
@@ -7,7 +7,11 @@ module Types
A global identifier.
A global identifier represents an object uniquely across the application.
- An example of such an identifier is `"gid://gitlab/User/1"`.
+ An example of a global identifier is `"gid://gitlab/User/1"`.
+
+ `gid://gitlab` stands for the root name.
+ `User` is the name of the ActiveRecord class of the record.
+ `1` is the record id as per the id in the db table.
Global identifiers are encoded as strings.
DESC
diff --git a/app/graphql/types/subscription_type.rb b/app/graphql/types/subscription_type.rb
index 33fc0cbe20e..7f33f77ec14 100644
--- a/app/graphql/types/subscription_type.rb
+++ b/app/graphql/types/subscription_type.rb
@@ -47,6 +47,11 @@ module Types
description: 'Triggered when a note is updated.',
alpha: { milestone: '15.9' }
+ field :work_item_updated,
+ subscription: Subscriptions::WorkItemUpdated,
+ null: true,
+ description: 'Triggered when a work item is updated.'
+
field :merge_request_reviewers_updated,
subscription: Subscriptions::IssuableUpdated, null: true,
description: 'Triggered when the reviewers of a merge request are updated.'
diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb
index 758aa3e294e..0feaee2bd93 100644
--- a/app/helpers/auth_helper.rb
+++ b/app/helpers/auth_helper.rb
@@ -16,6 +16,7 @@ module AuthHelper
jwt
openid_connect
salesforce
+ shibboleth
twitter
).freeze
LDAP_PROVIDER = /\Aldap/.freeze
diff --git a/app/models/plan_limits.rb b/app/models/plan_limits.rb
index 2e9a6552b5d..09cac87ce01 100644
--- a/app/models/plan_limits.rb
+++ b/app/models/plan_limits.rb
@@ -4,6 +4,7 @@ class PlanLimits < ApplicationRecord
include IgnorableColumns
ignore_column :ci_max_artifact_size_running_container_scanning, remove_with: '14.3', remove_after: '2021-08-22'
ignore_column :web_hook_calls_high, remove_with: '15.10', remove_after: '2022-02-22'
+ ignore_column :ci_active_pipelines, remove_with: '16.3', remove_after: '2022-07-22'
LimitUndefinedError = Class.new(StandardError)
diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb
index 88eb7e69267..a17ca62ccab 100644
--- a/app/services/issues/update_service.rb
+++ b/app/services/issues/update_service.rb
@@ -116,6 +116,13 @@ module Issues
attr_reader :perform_spam_check
+ override :after_update
+ def after_update(issue, _old_associations)
+ super
+
+ GraphqlTriggers.work_item_updated(issue)
+ end
+
def handle_date_changes(issue)
return unless issue.previous_changes.slice('due_date', 'start_date').any?
diff --git a/app/services/work_items/update_service.rb b/app/services/work_items/update_service.rb
index c96a6334d24..27b318d280f 100644
--- a/app/services/work_items/update_service.rb
+++ b/app/services/work_items/update_service.rb
@@ -59,6 +59,7 @@ module WorkItems
super
end
+ override :after_update
def after_update(work_item, old_associations)
super