Skip to content

Commit

Permalink
update profile of current_user before it's used by plugins refs codef…
Browse files Browse the repository at this point in the history
  • Loading branch information
shimomura1004 committed Jul 6, 2014
1 parent fbec21a commit f971a5c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/api/v1/message_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ def create
files = (params["files"] || {}).values
has_files = !(files.empty?)

profile = current_user.user_profiles.to_a.find{|profile| profile.room_id == room._id}
if profile
current_user.name = profile.name
current_user.profile_image_url = profile.profile_image_url
end

case message = Message.make(current_user, room, params[:message], has_files)
when Message
files.each {|file| message.attach(file)}
Expand Down

0 comments on commit f971a5c

Please sign in to comment.