5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 00:46:23 +00:00

fix: no podemos saber quién subió el archivo todavía

This commit is contained in:
f 2023-03-25 15:29:49 -03:00
parent fc86f4829f
commit 8c0ae30d75
2 changed files with 8 additions and 5 deletions

View file

@ -24,7 +24,7 @@ module ActiveStorage
instrument :upload, key: key, checksum: checksum do instrument :upload, key: key, checksum: checksum do
unless exist?(key) unless exist?(key)
IO.copy_stream(io, make_path_for(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 end
ensure_integrity_of(key, checksum) if checksum ensure_integrity_of(key, checksum) if checksum
end end

View file

@ -2,14 +2,13 @@
# Representa un objeto git LFS # Representa un objeto git LFS
class LfsObjectService class LfsObjectService
attr_reader :site, :blob, :usuarie attr_reader :site, :blob
# @param :site [Site] # @param :site [Site]
# @param :blob [ActiveStorage::Blob] # @param :blob [ActiveStorage::Blob]
def initialize(site:, blob:, usuarie:) def initialize(site:, blob:)
@site = site @site = site
@blob = blob @blob = blob
@usuarie = usuarie
end end
def process def process
@ -23,7 +22,7 @@ class LfsObjectService
Site::Writer.new(site: site, file: path, content: pointer).save Site::Writer.new(site: site, file: path, content: pointer).save
# Commitear el pointer # 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 # Eliminar el pointer
FileUtils.rm(path) FileUtils.rm(path)
@ -61,4 +60,8 @@ class LfsObjectService
size #{size} size #{size}
POINTER POINTER
end end
def author
@author ||= GitAuthor.new email: "disk_service@#{Site.domain}", name: 'DiskService'
end
end end