debian-mirror-gitlab/app/services/service_desk_settings/update_service.rb
2020-08-09 17:44:08 +05:30

19 lines
458 B
Ruby

# frozen_string_literal: true
module ServiceDeskSettings
class UpdateService < BaseService
def execute
settings = ServiceDeskSetting.safe_find_or_create_by!(project_id: project.id)
unless ::Feature.enabled?(:service_desk_custom_address, project)
params.delete(:project_key)
end
if settings.update(params)
success
else
error(settings.errors.full_messages.to_sentence)
end
end
end
end