mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 20:06:22 +00:00
fix: no podemos saber quién subió el archivo todavía
This commit is contained in:
parent
fc86f4829f
commit
8c0ae30d75
2 changed files with 8 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue