Class: Message

Inherits:
ApplicationRecord show all
Includes:
Diaspora::Federated::Base, Diaspora::Fields::Author, Diaspora::Fields::Guid, Reference::Source
Defined in:
app/models/message.rb

Instance Method Summary collapse

Methods included from Reference::Source

#create_references

Methods included from Diaspora::Fields::Author

included

Methods included from Diaspora::Fields::Guid

included, #set_guid

Methods included from Diaspora::Federated::Base

#object_to_receive

Instance Method Details

#conversation_guid=(guid) ⇒ Object


17
18
19
# File 'app/models/message.rb', line 17

def conversation_guid=(guid)
  self.conversation_id = Conversation.where(guid: guid).ids.first
end

#increase_unread(user) ⇒ Object


21
22
23
24
25
26
# File 'app/models/message.rb', line 21

def increase_unread(user)
  vis = ConversationVisibility.find_by(conversation_id: conversation_id, person_id: user.person.id)
  return unless vis
  vis.unread += 1
  vis.save
end

#messageObject


28
29
30
# File 'app/models/message.rb', line 28

def message
  @message ||= Diaspora::MessageRenderer.new text
end

#subscribersArray<Person>

Returns:


33
34
35
# File 'app/models/message.rb', line 33

def subscribers
  conversation.participants
end