Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Incorporate Judith's feedback

Marcello Rochabe628d96b388
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_ids_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_ids_query.rb
index 9c785590b37..8b5e3c60868 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_ids_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_ids_query.rb
@@ -33,6 +33,7 @@ module Storages
module StorageInteraction
module Nextcloud
class FileIdsQuery
+ include Snitch
def self.call(storage:, path:)
new(storage).call(path:)
end
@@ -43,8 +44,10 @@ module Storages
def call(path:)
query_params = { depth: "1", path:, props: %w[oc:fileid] }
- Rails.logger.tagged(self.class).info "Requesting File Ids on path: #{path} and args: #{query_params.inspect}"
- @query.call(**query_params)
+ with_tagged_logger do
+ info "Requesting File Ids on path: #{path} and args: #{query_params.inspect}"
+ @query.call(**query_params)
+ end
end
end
end
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query_legacy.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query_legacy.rb
index 207b2ccf16b..6b04c969db0 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query_legacy.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query_legacy.rb
@@ -34,6 +34,7 @@ module Storages
module Nextcloud
module Internal
class PropfindQueryLegacy
+ include Snitch
def self.call(storage:, depth:, path:, props:)
new(storage).call(depth:, path:, props:)
end
@@ -47,7 +48,7 @@ module Storages
# rubocop:disable Metrics/AbcSize
def call(depth:, path:, props:)
- Rails.logger.tagged(self.class) do
+ with_tagged_logger do
body = Nokogiri::XML::Builder.new do |xml|
xml["d"].propfind(
"xmlns:d" => "DAV:",
@@ -78,9 +79,9 @@ module Storages
case response
in { status: 200..299 }
log_response(response)
- log_message "Parsing XML response body"
+ info "Parsing XML response body"
doc = Nokogiri::XML(response.body.to_s)
- Rails.logger.info "Parsing response body"
+ info "Parsing response body"
result = doc.xpath("/d:multistatus/d:response").each_with_object({}) do |resource_section, hash|
source_path = UrlBuilder.path(@storage.uri.path, "/remote.php/dav/files", @username)
resource = CGI.unescape(resource_section.xpath("d:href").text.strip).gsub!(source_path, "")
@@ -94,7 +95,7 @@ module Storages
end
end
- log_message "Response parsed found: #{result.inspect}"
+ info "Response parsed found: #{result.inspect}"
ServiceResult.success(result:)
in { status: 405 }
log_response(response)
@@ -113,11 +114,7 @@ module Storages
# rubocop:enable Metrics/AbcSize
def log_response(response)
- log_message "Storage responded with a #{response.status} code."
- end
-
- def log_message(message)
- Rails.logger.info message
+ info "Storage responded with a #{response.status} code."
end
end
end