diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-29 21:28:21 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-09-29 21:28:21 +0200 |
commit | 927333f4f89403c5a6a2b421065112e517d88193 (patch) | |
tree | 1767e142ee9263b5b6968b5b43228ee0889232c5 /app/models/stream_entry.rb | |
parent | e4aebad35afae12f4b7503fb6c3783fcd3809761 (diff) |
Improve code style
Diffstat (limited to 'app/models/stream_entry.rb')
-rw-r--r-- | app/models/stream_entry.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/app/models/stream_entry.rb b/app/models/stream_entry.rb index f33295796..261ecda53 100644 --- a/app/models/stream_entry.rb +++ b/app/models/stream_entry.rb @@ -10,16 +10,16 @@ class StreamEntry < ApplicationRecord validates :account, :activity, presence: true - STATUS_INCLUDES = [:account, :stream_entry, :media_attachments, mentions: :account, reblog: [:stream_entry, :account, mentions: :account], thread: [:stream_entry, :account]] + STATUS_INCLUDES = [:account, :stream_entry, :media_attachments, 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]) } def object_type - orphaned? ? :activity : (targeted? ? :activity : self.activity.object_type) + orphaned? ? :activity : (targeted? ? :activity : activity.object_type) end def verb - orphaned? ? :delete : self.activity.verb + orphaned? ? :delete : activity.verb end def targeted? @@ -27,15 +27,15 @@ class StreamEntry < ApplicationRecord end def target - orphaned? ? nil : self.activity.target + orphaned? ? nil : activity.target end def title - orphaned? ? nil : self.activity.title + orphaned? ? nil : activity.title end def content - orphaned? ? nil : self.activity.content + orphaned? ? nil : activity.content end def threaded? @@ -43,20 +43,20 @@ class StreamEntry < ApplicationRecord end def thread - orphaned? ? nil : self.activity.thread + orphaned? ? nil : activity.thread end def mentions - self.activity.respond_to?(:mentions) ? self.activity.mentions.map { |x| x.account } : [] + activity.respond_to?(:mentions) ? activity.mentions.map { |x| x.account } : [] end def activity - self.send(self.activity_type.downcase.to_sym) + send(activity_type.downcase.to_sym) end private def orphaned? - self.activity.nil? + activity.nil? end end |