add participant_users to conversations
This commit is contained in:
parent
9ee3b2d080
commit
655558cb95
1 changed files with 8 additions and 0 deletions
|
|
@ -36,11 +36,19 @@ class Conversation < ActiveRecord::Base
|
|||
def participant_handles
|
||||
self.participants.map{|p| p.diaspora_handle}.join(";")
|
||||
end
|
||||
|
||||
def participant_handles= handles
|
||||
handles.split(';').each do |handle|
|
||||
self.participants << Webfinger.new(handle).fetch
|
||||
end
|
||||
end
|
||||
|
||||
def participant_users
|
||||
@participant_users ||= lambda do
|
||||
user_ids = self.participants.map {|p| p.owner_id}.compact
|
||||
User.where(:id => user_ids)
|
||||
end.call
|
||||
end
|
||||
|
||||
def last_author
|
||||
self.messages.last.author if self.messages.size > 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue