From 3caf0cfb03841bbd646591ca9bc536ee7d9be918 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 22 Dec 2016 11:34:05 +0100 Subject: Ensure that reblogs and favs always refer to the original status rather than a reblog wrapper --- app/models/favourite.rb | 4 ++++ app/models/status.rb | 1 + 2 files changed, 5 insertions(+) (limited to 'app') 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 -- cgit