about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-05 18:39:53 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-05 18:39:53 +0200
commiteec0dc46a6d6782f6aebdc759d4822ef17fd57a2 (patch)
tree0c3f88e90e1f5274df1805c97181c3d6f3e3e40a /app/models
parentae1fac006206ab28cd7cba63ab85c07a27f3d606 (diff)
PostStatusService can attach media to status, ProcessFeedService likewise
Diffstat (limited to 'app/models')
-rw-r--r--app/models/media_attachment.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb
index af1a4b9af..3beb96e3a 100644
--- a/app/models/media_attachment.rb
+++ b/app/models/media_attachment.rb
@@ -10,4 +10,12 @@ class MediaAttachment < ApplicationRecord
   def local?
     self.remote_url.blank?
   end
+
+  def file_remote_url=(url)
+    unless self[:file_remote_url] == url
+      self.file = URI.parse(url)
+    end
+
+    self[:file_remote_url] = url
+  end
 end