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>2023-12-12 09:10:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-12-12 09:10:45 +0300
commitd89147da045b9d00c4e35de3c7b39ed2b02ef7a6 (patch)
treee5adaeb09829e7109ccabc97fc5d395c75e47027 /app/services
parentfdc2b6184d20e767f089557f3cdc68837a6aacfb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r--app/services/organizations/base_service.rb14
-rw-r--r--app/services/organizations/update_service.rb7
2 files changed, 13 insertions, 8 deletions
diff --git a/app/services/organizations/base_service.rb b/app/services/organizations/base_service.rb
index 3e734e3cd0c..6f91a81096f 100644
--- a/app/services/organizations/base_service.rb
+++ b/app/services/organizations/base_service.rb
@@ -9,11 +9,19 @@ module Organizations
def initialize(current_user: nil, params: {})
@current_user = current_user
@params = params.dup
- return unless @params.key?(:description)
- organization_detail_attributes = { description: @params.delete(:description) }
+ build_organization_detail_attributes
+ end
+
+ private
+
+ def build_organization_detail_attributes
@params[:organization_detail_attributes] ||= {}
- @params[:organization_detail_attributes].merge!(organization_detail_attributes)
+
+ organization_detail_attributes = [:description, :avatar]
+ organization_detail_attributes.each do |attribute|
+ @params[:organization_detail_attributes][attribute] = @params.delete(attribute) if @params.key?(attribute)
+ end
end
end
end
diff --git a/app/services/organizations/update_service.rb b/app/services/organizations/update_service.rb
index e262bd15bc0..1efb8b6fe22 100644
--- a/app/services/organizations/update_service.rb
+++ b/app/services/organizations/update_service.rb
@@ -8,13 +8,10 @@ module Organizations
@organization = organization
@current_user = current_user
@params = params.dup
- return unless @params.key?(:description)
- organization_detail_attributes = { description: @params.delete(:description) }
+ build_organization_detail_attributes
# TODO: Remove explicit passing of id once https://github.com/rails/rails/issues/48714 is resolved.
- organization_detail_attributes[:id] = organization.id
- @params[:organization_detail_attributes] ||= {}
- @params[:organization_detail_attributes].merge!(organization_detail_attributes)
+ @params[:organization_detail_attributes][:id] = organization.id
end
def execute