debian-mirror-gitlab/app/uploaders/attachment_uploader.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
636 B
Ruby
Raw Normal View History

2018-11-08 19:23:39 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
class AttachmentUploader < GitlabUploader
2018-03-17 18:26:18 +05:30
include RecordsUploads::Concern
2018-05-09 12:01:36 +05:30
include ObjectStorage::Concern
prepend ObjectStorage::Extension::RecordsUploads
include UploaderHelper
2014-09-02 18:07:02 +05:30
2018-03-17 18:26:18 +05:30
private
def dynamic_segment
2019-09-04 21:01:54 +05:30
File.join(model.class.underscore, mounted_as.to_s, model.id.to_s)
2014-09-02 18:07:02 +05:30
end
2020-04-08 14:13:33 +05:30
def mounted_as
# Geo fails to sync attachments on Note, and LegacyDiffNotes with missing mount_point.
#
# See https://gitlab.com/gitlab-org/gitlab/-/issues/209752 for more details.
if model.class.underscore.include?('note')
super || 'attachment'
else
super
end
end
2014-09-02 18:07:02 +05:30
end