- message = Message.where("to_user_id = ? OR from_user_id = ?", @user.id, @user.id).find(params[:message_id])
- message.from_user_visible = false if message.sender == @user
- message.to_user_visible = false if message.recipient == @user
- if message.save
+ @message = Message.where("to_user_id = ? OR from_user_id = ?", @user.id, @user.id).find(params[:message_id])
+ @message.from_user_visible = false if @message.sender == @user
+ @message.to_user_visible = false if @message.recipient == @user
+ if @message.save and not request.xhr?