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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-01 21:08:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-01 21:08:33 +0300
commit24d67ec55454fc6f4e8e80bf7c8dc5bc677e8514 (patch)
tree6ce73c2fd8ec96c6f043c4a1403c0991fd448b81 /app/models
parenta0fdcfcdd514c2af98f18cadfa75f8a6a85b4d2c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/build.rb4
-rw-r--r--app/models/ci/pipeline.rb2
-rw-r--r--app/models/integration.rb4
-rw-r--r--app/models/integrations/base_chat_notification.rb4
-rw-r--r--app/models/integrations/jira.rb3
-rw-r--r--app/models/oauth_access_token.rb2
-rw-r--r--app/models/user.rb2
7 files changed, 9 insertions, 12 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 18b6556039c..ced5fd31fd5 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -29,10 +29,6 @@ module Ci
return_exit_code: -> (build) { build.exit_codes_defined? }
}.freeze
- DEFAULT_RETRIES = {
- scheduler_failure: 2
- }.freeze
-
DEGRADATION_THRESHOLD_VARIABLE_NAME = 'DEGRADATION_THRESHOLD'
RUNNERS_STATUS_CACHE_EXPIRATION = 1.minute
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index d7889407849..c48e21cf061 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -27,8 +27,6 @@ module Ci
DEFAULT_CONFIG_PATH = CONFIG_EXTENSION
CANCELABLE_STATUSES = (Ci::HasStatus::CANCELABLE_STATUSES + ['manual']).freeze
- BridgeStatusError = Class.new(StandardError)
-
paginates_per 15
sha_attribute :source_sha
diff --git a/app/models/integration.rb b/app/models/integration.rb
index af8e8060d81..f5f701662e7 100644
--- a/app/models/integration.rb
+++ b/app/models/integration.rb
@@ -505,8 +505,8 @@ class Integration < ApplicationRecord
fields.reject { _1[:type] == 'password' }.pluck(:name)
end
- def global_fields
- fields
+ def form_fields
+ fields.reject { _1[:api_only] == true }
end
def configurable_events
diff --git a/app/models/integrations/base_chat_notification.rb b/app/models/integrations/base_chat_notification.rb
index 51f238d5eb9..c7992e4083c 100644
--- a/app/models/integrations/base_chat_notification.rb
+++ b/app/models/integrations/base_chat_notification.rb
@@ -139,8 +139,8 @@ module Integrations
supported_events.map { |event| event_channel_name(event) }
end
- def global_fields
- fields.reject { |field| field[:name].end_with?('channel') }
+ def form_fields
+ super.reject { |field| field[:name].end_with?('channel') }
end
def default_channel_placeholder
diff --git a/app/models/integrations/jira.rb b/app/models/integrations/jira.rb
index 125f52104d4..c9c9b9d59d6 100644
--- a/app/models/integrations/jira.rb
+++ b/app/models/integrations/jira.rb
@@ -71,11 +71,12 @@ module Integrations
non_empty_password_help: -> { s_('JiraService|Leave blank to use your current password or API token.') },
help: -> { s_('JiraService|Use a password for server version and an API token for cloud version.') }
+ field :jira_issue_transition_id, api_only: true
+
# TODO: we can probably just delegate as part of
# https://gitlab.com/gitlab-org/gitlab/issues/29404
# These fields are API only, so no field definition is required.
data_field :jira_issue_transition_automatic
- data_field :jira_issue_transition_id
data_field :project_key
data_field :issues_enabled
data_field :vulnerabilities_enabled
diff --git a/app/models/oauth_access_token.rb b/app/models/oauth_access_token.rb
index 9789d8ed62b..20130f01d44 100644
--- a/app/models/oauth_access_token.rb
+++ b/app/models/oauth_access_token.rb
@@ -7,6 +7,8 @@ class OauthAccessToken < Doorkeeper::AccessToken
alias_attribute :user, :resource_owner
scope :distinct_resource_owner_counts, ->(applications) { where(application: applications).distinct.group(:application_id).count(:resource_owner_id) }
+ scope :latest_per_application, -> { select('distinct on(application_id) *').order(application_id: :desc, created_at: :desc) }
+ scope :preload_application, -> { preload(:application) }
def scopes=(value)
if value.is_a?(Array)
diff --git a/app/models/user.rb b/app/models/user.rb
index 20ff796aba0..2afd64358ef 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1626,7 +1626,7 @@ class User < ApplicationRecord
end
def oauth_authorized_tokens
- Doorkeeper::AccessToken.where(resource_owner_id: id, revoked_at: nil)
+ OauthAccessToken.where(resource_owner_id: id, revoked_at: nil)
end
# Returns the projects a user contributed to in the last year.