about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-22 11:34:05 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-22 11:34:05 +0100
commit3caf0cfb03841bbd646591ca9bc536ee7d9be918 (patch)
tree899882842d18f2c5dc056354d0fd45f700890499 /app
parent025f7bb223daf88c89649251c28751b36197bff3 (diff)
Ensure that reblogs and favs always refer to the original status rather than a reblog wrapper
Diffstat (limited to 'app')
-rw-r--r--app/models/favourite.rb4
-rw-r--r--app/models/status.rb1
2 files changed, 5 insertions, 0 deletions
diff --git a/app/models/favourite.rb b/app/models/favourite.rb
index 541ca0831..2fc3d18cd 100644
--- a/app/models/favourite.rb
+++ b/app/models/favourite.rb
@@ -28,4 +28,8 @@ class Favourite < ApplicationRecord
   def target
     thread
   end
+
+  before_validation do
+    self.status = status.reblog if status.reblog?
+  end
 end
diff --git a/app/models/status.rb b/app/models/status.rb
index e87828e32..76ada5227 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -160,6 +160,7 @@ class Status < ApplicationRecord
 
   before_validation do
     text.strip!
+    self.reblog = reblog.reblog if reblog? && reblog.reblog?
     self.in_reply_to_account_id = thread.account_id if reply?
   end
 end