Class: Chat::MessageRelayJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- ApplicationJob
- Chat::MessageRelayJob
- Defined in:
- app/jobs/chat/message_relay_job.rb
Instance Method Summary collapse
Instance Method Details
#content(message) ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/jobs/chat/message_relay_job.rb', line 18 def content() if .image? { message: renderer.image_tag(.image.url), image: true } else { message: .text, image: false } end end |
#perform(message_id) ⇒ Object
5 6 7 8 9 10 |
# File 'app/jobs/chat/message_relay_job.rb', line 5 def perform() = Chat::Message.find() broadcast( "chats::#{.conversation_id}::messages", () ) end |
#render_message(message) ⇒ Object
12 13 14 15 16 |
# File 'app/jobs/chat/message_relay_job.rb', line 12 def () { user: .user_id, avatar: renderer.chat_avatar(.user).to_s }.merge(content()) end |