diff options
Diffstat (limited to 'app/models/stream_entry.rb')
-rw-r--r-- | app/models/stream_entry.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/app/models/stream_entry.rb b/app/models/stream_entry.rb index fcc691bef..ae7ae446e 100644 --- a/app/models/stream_entry.rb +++ b/app/models/stream_entry.rb @@ -6,16 +6,13 @@ class StreamEntry < ApplicationRecord belongs_to :account, inverse_of: :stream_entries belongs_to :activity, polymorphic: true - belongs_to :status, foreign_type: 'Status', foreign_key: 'activity_id' - belongs_to :follow, foreign_type: 'Follow', foreign_key: 'activity_id' - belongs_to :favourite, foreign_type: 'Favourite', foreign_key: 'activity_id' - belongs_to :block, foreign_type: 'Block', foreign_key: 'activity_id' + belongs_to :status, foreign_type: 'Status', foreign_key: 'activity_id', inverse_of: :stream_entry validates :account, :activity, presence: true STATUS_INCLUDES = [:account, :stream_entry, :media_attachments, :tags, mentions: :account, reblog: [:stream_entry, :account, mentions: :account], thread: [:stream_entry, :account]].freeze - scope :with_includes, -> { includes(:account, status: STATUS_INCLUDES, favourite: [:account, :stream_entry, status: STATUS_INCLUDES], follow: [:target_account, :stream_entry]) } + scope :with_includes, -> { includes(:account, status: STATUS_INCLUDES) } def object_type if orphaned? @@ -30,7 +27,7 @@ class StreamEntry < ApplicationRecord end def targeted? - [:follow, :unfollow, :block, :unblock, :share, :favorite].include? verb + [:follow, :request_friend, :authorize, :reject, :unfollow, :block, :unblock, :share, :favorite].include? verb end def target @@ -58,7 +55,7 @@ class StreamEntry < ApplicationRecord end def activity - !new_record? ? send(activity_type.downcase) : super + !new_record? ? send(activity_type.underscore) || super : super end private |