about summary refs log tree commit diff
path: root/app/models/stream_entry.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-11 17:09:36 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-11 17:13:11 +0100
commit50660d54e8cabd08fee649a6abc26f35a8d7a82c (patch)
tree0124bd26554896a409dc7b7b6bb357fc8be8e2c6 /app/models/stream_entry.rb
parent0b95eb36128077b3074f661dd451a90a18441ef0 (diff)
Fix semantics of follow requests another slaps
Diffstat (limited to 'app/models/stream_entry.rb')
-rw-r--r--app/models/stream_entry.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/app/models/stream_entry.rb b/app/models/stream_entry.rb
index e0b85be15..bb68b1e14 100644
--- a/app/models/stream_entry.rb
+++ b/app/models/stream_entry.rb
@@ -6,10 +6,11 @@ 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'
+  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 :follow_request, foreign_type: 'FollowRequest', foreign_key: 'activity_id'
 
   validates :account, :activity, presence: true
 
@@ -30,7 +31,7 @@ class StreamEntry < ApplicationRecord
   end
 
   def targeted?
-    [:follow, :request_friend, :authorize, :unfollow, :block, :unblock, :share, :favorite].include? verb
+    [:follow, :request_friend, :authorize, :reject, :unfollow, :block, :unblock, :share, :favorite].include? verb
   end
 
   def target
@@ -58,7 +59,7 @@ class StreamEntry < ApplicationRecord
   end
 
   def activity
-    !new_record? ? send(activity_type.downcase) : super
+    !new_record? ? send(activity_type.underscore) : super
   end
 
   private