diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-09-14 22:48:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 22:48:26 +0200 |
commit | 35469b1952c03ba8192bd28fc9cbc39cdcca9f4c (patch) | |
tree | 66532e59f7ebfc0512af062c97291c46872be238 /app/models | |
parent | 7aa4d481db4ad5dfa65e5b28a5a83f643cea5763 (diff) | |
parent | f1e6884d6bee3b4e426863c63c8d81e940d21a20 (diff) |
Merge pull request #1602 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/media_attachment.rb | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index a6ab22f61..8bc4578ba 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -255,7 +255,7 @@ class MediaAttachment < ApplicationRecord after_commit :reset_parent_cache, on: :update before_create :prepare_description, unless: :local? - before_create :set_shortcode + before_create :set_unknown_type before_create :set_processing after_post_process :set_meta @@ -298,15 +298,8 @@ class MediaAttachment < ApplicationRecord private - def set_shortcode + def set_unknown_type self.type = :unknown if file.blank? && !type_changed? - - return unless local? - - loop do - self.shortcode = SecureRandom.urlsafe_base64(14) - break if MediaAttachment.find_by(shortcode: shortcode).nil? - end end def prepare_description |