- # Allow the user to write a new message to another user. This action also
- # deals with the sending of that message to the other user when the user
- # clicks send.
- # The display_name param is the display name of the user that the message is being sent to.
+ allow_thirdparty_images :only => [:new, :create, :show]
+
+ # Show a message
+ def show
+ @title = t ".title"
+ @message = Message.find(params[:id])
+
+ if @message.recipient == current_user || @message.sender == current_user
+ @message.message_read = true if @message.recipient == current_user
+ @message.save
+ else
+ flash[:notice] = t ".wrong_user", :user => current_user.display_name
+ redirect_to login_path(:referer => request.fullpath)
+ end
+ rescue ActiveRecord::RecordNotFound
+ @title = t "messages.no_such_message.title"
+ render :action => "no_such_message", :status => :not_found
+ end
+
+ # Allow the user to write a new message to another user.