]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/message_controller.rb
Make sure we report "no results" when Nominatim's reverse geocoder fails
[rails.git] / app / controllers / message_controller.rb
index 73abc68cc2d9cfa7fbea7395ebbeadb5cf2f6340..435c3fa78455cb68907d1eaa70d21bee45959def 100644 (file)
@@ -100,8 +100,15 @@ class MessageController < ApplicationController
       end
       message.message_read = message_read
       if message.save
-        flash[:notice] = notice
-        redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
+        if request.xhr?
+          render :update do |page|
+            page.replace "inbox-count", :partial => "message_count"
+            page.replace "inbox-#{message.id}", :partial => "message_summary", :object => message
+          end
+        else
+          flash[:notice] = notice
+          redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
+        end
       end
     end
   rescue ActiveRecord::RecordNotFound