docbrown/app/views/chat_channels/show.json.jbuilder
Mac Siri 7cb65649e4 Update chat app (#326)
* Fix spacing

* Update webpacker gem to 3.5

* Add custom preact-compact config

* Add babel-loader to resolve a weird issue

* Add react-textarea-autocomplete

* Move 2 dependencies into devDependencies

* Add babel-eslint & eslint-plugin-babel

* Refactor chat

* Add fixed width to chat's channels

* Add timestamp for chat

* Fix long word issue

* Add showTimestamp options to chat

* Add profile image to chat

* Make profile image in chat circle

* Improve message send logic

* Add proper user session handling for chat

* Choose profile user image source for chat

* Adjust user's text color

* Fix lint
2018-05-21 13:19:56 -04:00

12 lines
422 B
Ruby

json.messages @chat_channel.messages.order("created_at DESC").limit(50).reverse do |message|
json.user_id message.user.id
json.username message.user.username
json.profile_image_url ProfileImage.new(message.user).get(90)
json.message message.message_markdown
json.timestamp message.created_at
json.color message.preferred_user_color
end
json.key_format! camelize: :lower
json.chat_channel_id @chat_channel.id