Deleting statuses, deletion propagation
This commit is contained in:
parent
75b3339a99
commit
5c99e304e5
5 changed files with 18 additions and 12 deletions
|
@ -5,11 +5,11 @@ class StreamEntry < ActiveRecord::Base
|
|||
validates :account, :activity, presence: true
|
||||
|
||||
def object_type
|
||||
targeted? ? :activity : self.activity.object_type
|
||||
orphaned? ? :activity : (targeted? ? :activity : self.activity.object_type)
|
||||
end
|
||||
|
||||
def verb
|
||||
self.activity.verb
|
||||
orphaned? ? :delete : self.activity.verb
|
||||
end
|
||||
|
||||
def targeted?
|
||||
|
@ -17,15 +17,15 @@ class StreamEntry < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def target
|
||||
self.activity.target
|
||||
orphaned? ? nil : self.activity.target
|
||||
end
|
||||
|
||||
def title
|
||||
self.activity.title
|
||||
orphaned? ? nil : self.activity.title
|
||||
end
|
||||
|
||||
def content
|
||||
self.activity.content
|
||||
orphaned? ? nil : self.activity.content
|
||||
end
|
||||
|
||||
def threaded?
|
||||
|
@ -33,10 +33,16 @@ class StreamEntry < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def thread
|
||||
self.activity.thread
|
||||
orphaned? ? nil : self.activity.thread
|
||||
end
|
||||
|
||||
def mentions
|
||||
self.activity.mentions
|
||||
orphaned? ? [] : self.activity.mentions
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def orphaned?
|
||||
self.activity.nil?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue