X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/16bef0c8ecad24ac0ca93963196bc844adbb57de..41d6f19a6bed3b1a53f2fba12ca86ffbac1f8f5a:/app/controllers/messages_controller.rb diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index c93c998f0..a55690951 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -3,7 +3,9 @@ class MessagesController < ApplicationController before_action :authorize_web before_action :set_locale - before_action :require_user + + authorize_resource + before_action :lookup_user, :only => [:new, :create] before_action :check_database_readable before_action :check_database_writable, :only => [:new, :create, :reply, :mark, :destroy] @@ -24,7 +26,7 @@ class MessagesController < ApplicationController @message.sender = current_user @message.sent_on = Time.now.getutc - if current_user.sent_messages.where("sent_on >= ?", Time.now.getutc - 1.hour).count >= MAX_MESSAGES_PER_HOUR + if current_user.sent_messages.where("sent_on >= ?", Time.now.getutc - 1.hour).count >= Settings.max_messages_per_hour flash[:error] = t ".limit_exceeded" render :action => "new" elsif @message.save @@ -32,6 +34,7 @@ class MessagesController < ApplicationController Notifier.message_notification(@message).deliver_later redirect_to :action => :inbox else + @title = t "messages.new.title" render :action => "new" end end