about summary refs log tree commit diff
path: root/app/models/stream_entry.rb
blob: cee151a077277b204e9e4c0ca60a30123eed8f20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class StreamEntry < ActiveRecord::Base
  belongs_to :account, inverse_of: :stream_entries
  belongs_to :activity, polymorphic: true

  def object_type
    case self.activity_type
    when 'Status'
      :note
    when 'Follow'
      :person
    end
  end

  def verb
    case self.activity_type
    when 'Status'
      :post
    when 'Follow'
      :follow
    end
  end

  def target
    case self.activity_type
    when 'Follow'
      self.activity.target_account
    end
  end

  def content
    self.activity.text if self.activity_type == 'Status'
  end
end