- before_action :check_database_writable, :only => [:new, :reply, :mark, :destroy]
- before_action :allow_thirdparty_images, :only => [:new, :show]
+ before_action :check_database_writable, :only => [:new, :create, :reply, :mark, :destroy]
+ before_action :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