]> cat aescling's git repositories - mastodon.git/commitdiff
Ensure that reblogs and favs always refer to the original status rather than a reblog...
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 22 Dec 2016 10:34:05 +0000 (11:34 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 22 Dec 2016 10:34:05 +0000 (11:34 +0100)
app/models/favourite.rb
app/models/status.rb

index 541ca08314bfe7c71a7f9a94385a9bdee6e56537..2fc3d18cde785248f1bd591ab1da560a01f0bbb4 100644 (file)
@@ -28,4 +28,8 @@ class Favourite < ApplicationRecord
   def target
     thread
   end
+
+  before_validation do
+    self.status = status.reblog if status.reblog?
+  end
 end
index e87828e328b83b12d2ada71505dd667de67595fe..76ada52275bd95856f63f153f63e24e73bc504ad 100644 (file)
@@ -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