X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/cf21eae743566090dbdd42198245d6d5183d4fdb..7eb181999d3357bf210ceb24e18c913bf3ef6ba3:/app/controllers/message_controller.rb diff --git a/app/controllers/message_controller.rb b/app/controllers/message_controller.rb index 9dc1d6922..395d56028 100644 --- a/app/controllers/message_controller.rb +++ b/app/controllers/message_controller.rb @@ -20,6 +20,18 @@ class MessageController < ApplicationController end end + def destroy + @message = Message.find(params[:message_id], :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id ]) + if !@message.message_read + flash[:notice] = 'Message not read and so not deleted' + redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name + else + flash[:notice] = "Message '#{@message.title}' deleted" + @message.destroy + redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name + end + end + def reply message = Message.find(params[:message_id], :conditions => ["to_user_id = ? or from_user_id = ?", @user.id, @user.id ]) title = message.title.sub(/^Re:\s*/, "Re: ")