From 2940b5d3e818d047afedf173df0d7a2d6b6f0613 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 25 Mar 2023 15:29:49 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20no=20podemos=20saber=20qui=C3=A9n=20subi?= =?UTF-8?q?=C3=B3=20el=20archivo=20todav=C3=ADa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lib/active_storage/service/jekyll_service.rb | 2 +- app/services/lfs_object_service.rb | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/lib/active_storage/service/jekyll_service.rb b/app/lib/active_storage/service/jekyll_service.rb index 6763ee0d..f399f440 100644 --- a/app/lib/active_storage/service/jekyll_service.rb +++ b/app/lib/active_storage/service/jekyll_service.rb @@ -24,7 +24,7 @@ module ActiveStorage instrument :upload, key: key, checksum: checksum do unless exist?(key) IO.copy_stream(io, make_path_for(key)) - LfsObjectService.new(site: site, usuarie: current_usuarie, blob: blob).process + LfsObjectService.new(site: site, blob: blob).process end ensure_integrity_of(key, checksum) if checksum end diff --git a/app/services/lfs_object_service.rb b/app/services/lfs_object_service.rb index 61775e12..bb62301d 100644 --- a/app/services/lfs_object_service.rb +++ b/app/services/lfs_object_service.rb @@ -2,14 +2,13 @@ # Representa un objeto git LFS class LfsObjectService - attr_reader :site, :blob, :usuarie + attr_reader :site, :blob # @param :site [Site] # @param :blob [ActiveStorage::Blob] - def initialize(site:, blob:, usuarie:) + def initialize(site:, blob:) @site = site @blob = blob - @usuarie = usuarie end def process @@ -23,7 +22,7 @@ class LfsObjectService Site::Writer.new(site: site, file: path, content: pointer).save # Commitear el pointer - site.repository.commit(file: path, usuarie: usuarie, message: File.basename(path)) + site.repository.commit(file: path, usuarie: author, message: File.basename(path)) # Eliminar el pointer FileUtils.rm(path) @@ -61,4 +60,8 @@ class LfsObjectService size #{size} POINTER end + + def author + @author ||= GitAuthor.new email: "disk_service@#{Site.domain}", name: 'DiskService' + end end