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>2024-01-22 03:10:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2024-01-22 03:10:19 +0300
commit4d90876cc6b35bc418ccb6ea2536581289b272fb (patch)
treea74ea127264fa7deaaf4f1067b94687541343e8c /app
parent61d7d07541aafcf49a97159a6048cf6847adbd51 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/models/integration.rb4
-rw-r--r--app/models/integrations/gitlab_slack_application.rb4
-rw-r--r--app/models/organizations/organization_user.rb11
-rw-r--r--app/models/user.rb15
4 files changed, 33 insertions, 1 deletions
diff --git a/app/models/integration.rb b/app/models/integration.rb
index aa02db949bf..2491e961bc3 100644
--- a/app/models/integration.rb
+++ b/app/models/integration.rb
@@ -547,7 +547,9 @@ class Integration < ApplicationRecord
end
def self.api_fields
- fields.map do |field|
+ fields.filter_map do |field|
+ next if field.if != true
+
{
required: field.required?,
name: field.name.to_sym,
diff --git a/app/models/integrations/gitlab_slack_application.rb b/app/models/integrations/gitlab_slack_application.rb
index d008a28a226..66746117c00 100644
--- a/app/models/integrations/gitlab_slack_application.rb
+++ b/app/models/integrations/gitlab_slack_application.rb
@@ -71,6 +71,10 @@ module Integrations
super.drop(1)
end
+ def self.webhook_help
+ # no-op
+ end
+
override :configurable_events
def configurable_events
return [] unless editable?
diff --git a/app/models/organizations/organization_user.rb b/app/models/organizations/organization_user.rb
index 9e06870dcc6..5916f8c950f 100644
--- a/app/models/organizations/organization_user.rb
+++ b/app/models/organizations/organization_user.rb
@@ -16,5 +16,16 @@ module Organizations
}
scope :owners, -> { where(access_level: Gitlab::Access::OWNER) }
+
+ def self.create_default_organization_record_for(user_id, access_level)
+ Organizations::OrganizationUser.upsert(
+ {
+ organization_id: Organizations::Organization::DEFAULT_ORGANIZATION_ID,
+ user_id: user_id,
+ access_level: access_level
+ },
+ unique_by: [:organization_id, :user_id]
+ )
+ end
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 8289776b959..ab5572e5b19 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -373,6 +373,8 @@ class User < MainClusterwide::ApplicationRecord
update_invalid_gpg_signatures if previous_changes.key?('email')
end
+ after_create_commit :create_default_organization_user
+
# User's Layout preference
enum layout: { fixed: 0, fluid: 1 }
@@ -2600,6 +2602,19 @@ class User < MainClusterwide::ApplicationRecord
FEED_TOKEN_PREFIX
end
+ def create_default_organization_user
+ return unless Feature.enabled?(:update_default_organization_users, self, type: :gitlab_com_derisk)
+
+ organization_access_level = if admin?
+ :owner
+ else
+ :default
+ end
+
+ Organizations::OrganizationUser
+ .create_default_organization_record_for(id, organization_access_level)
+ end
+
# method overriden in EE
def audit_lock_access(reason: nil); end