Merge remote-tracking branch 'upstream/master' into routing-ui-tweaks-2

Conflicts:
	config/locales/de.yml
This commit is contained in:
Matt Amos 2015-01-26 13:14:58 +00:00
commit c3e2e6462f
381 changed files with 5384 additions and 1904 deletions

View file

@ -192,14 +192,22 @@ class ApplicationController < ActionController::Base
def check_database_readable(need_api = false)
if STATUS == :database_offline or (need_api and STATUS == :api_offline)
redirect_to :controller => 'site', :action => 'offline'
if request.xhr?
report_error "Database offline for maintenance", :service_unavailable
else
redirect_to :controller => 'site', :action => 'offline'
end
end
end
def check_database_writable(need_api = false)
if STATUS == :database_offline or STATUS == :database_readonly or
(need_api and (STATUS == :api_offline or STATUS == :api_readonly))
redirect_to :controller => 'site', :action => 'offline'
if request.xhr?
report_error "Database offline for maintenance", :service_unavailable
else
redirect_to :controller => 'site', :action => 'offline'
end
end
end

View file

@ -3,7 +3,7 @@ class BrowseController < ApplicationController
before_filter :authorize_web
before_filter :set_locale
before_filter { |c| c.check_database_readable(true) }
before_filter :except => [ :query ] { |c| c.check_database_readable(true) }
before_filter :require_oauth
around_filter :web_timeout

View file

@ -336,12 +336,12 @@ class ChangesetController < ApplicationController
# Notify current subscribers of the new comment
changeset.subscribers.each do |user|
if @user != user
Notifier.changeset_comment_notification(comment, user).deliver
Notifier.changeset_comment_notification(comment, user).deliver_now
end
end
# Add the commenter to the subscribers if necessary
changeset.subscribers << @user unless changeset.subscribers.exists?(@user)
changeset.subscribers << @user unless changeset.subscribers.exists?(@user.id)
# Return a copy of the updated changeset
render :text => changeset.to_xml.to_s, :content_type => "text/xml"
@ -359,7 +359,7 @@ class ChangesetController < ApplicationController
# Find the changeset and check it is valid
changeset = Changeset.find(id)
raise OSM::APIChangesetNotYetClosedError.new(changeset) if changeset.is_open?
raise OSM::APIChangesetAlreadySubscribedError.new(changeset) if changeset.subscribers.exists?(@user)
raise OSM::APIChangesetAlreadySubscribedError.new(changeset) if changeset.subscribers.exists?(@user.id)
# Add the subscriber
changeset.subscribers << @user
@ -380,7 +380,7 @@ class ChangesetController < ApplicationController
# Find the changeset and check it is valid
changeset = Changeset.find(id)
raise OSM::APIChangesetNotYetClosedError.new(changeset) if changeset.is_open?
raise OSM::APIChangesetNotSubscribedError.new(changeset) unless changeset.subscribers.exists?(@user)
raise OSM::APIChangesetNotSubscribedError.new(changeset) unless changeset.subscribers.exists?(@user.id)
# Remove the subscriber
changeset.subscribers.delete(@user)

View file

@ -58,7 +58,7 @@ class DiaryEntryController < ApplicationController
@diary_comment.user = @user
if @diary_comment.save
if @diary_comment.user != @entry.user
Notifier.diary_comment_notification(@diary_comment).deliver
Notifier.diary_comment_notification(@diary_comment).deliver_now
end
redirect_to :controller => 'diary_entry', :action => 'view', :display_name => @entry.user.display_name, :id => @entry.id

View file

@ -24,14 +24,14 @@ class MessageController < ApplicationController
if @message.save
flash[:notice] = t 'message.new.message_sent'
Notifier.message_notification(@message).deliver
Notifier.message_notification(@message).deliver_now
redirect_to :controller => 'message', :action => 'inbox', :display_name => @user.display_name
end
end
else
@message = Message.new(:recipient => @this_user)
@title = t 'message.new.title'
end
@message ||= Message.new(:recipient => @this_user)
@title = t 'message.new.title'
end
# Allow the user to reply to another message.

View file

@ -361,7 +361,7 @@ private
note.comments.map { |c| c.author }.uniq.each do |user|
if notify and user and user != @user
Notifier.note_comment_notification(comment, user).deliver
Notifier.note_comment_notification(comment, user).deliver_now
end
end
end

View file

@ -10,7 +10,7 @@ class RedactionsController < ApplicationController
before_filter :check_database_writable, :only => [:create, :update, :destroy]
def index
@redactions_pages, @redactions = paginate(:redactions, :order => :id, :per_page => 10)
@redactions = Redaction.order(:id)
end
def new

View file

@ -105,7 +105,7 @@ class UserController < ApplicationController
successful_login(@user)
else
session[:token] = @user.tokens.create.token
Notifier.signup_confirm(@user, @user.tokens.create(:referer => referer)).deliver
Notifier.signup_confirm(@user, @user.tokens.create(:referer => referer)).deliver_now
redirect_to :action => 'confirm', :display_name => @user.display_name
end
else
@ -165,7 +165,7 @@ class UserController < ApplicationController
if user
token = user.tokens.create
Notifier.lost_password(user, token).deliver
Notifier.lost_password(user, token).deliver_now
flash[:notice] = t 'user.lost_password.notice email on way'
redirect_to :action => 'login'
else
@ -353,7 +353,7 @@ class UserController < ApplicationController
def confirm_resend
if user = User.find_by_display_name(params[:display_name])
Notifier.signup_confirm(user, user.tokens.create).deliver
Notifier.signup_confirm(user, user.tokens.create).deliver_now
flash[:notice] = t 'user.confirm_resend.success', :email => user.email
else
flash[:notice] = t 'user.confirm_resend.failure', :name => params[:display_name]
@ -424,7 +424,7 @@ class UserController < ApplicationController
unless @user.is_friends_with?(@new_friend)
if friend.save
flash[:notice] = t 'user.make_friend.success', :name => @new_friend.display_name
Notifier.friend_notification(friend).deliver
Notifier.friend_notification(friend).deliver_now
else
friend.add_error(t('user.make_friend.failed', :name => @new_friend.display_name))
end
@ -733,7 +733,7 @@ private
flash.now[:notice] = t 'user.account.flash update success confirm needed'
begin
Notifier.email_confirm(user, user.tokens.create).deliver
Notifier.email_confirm(user, user.tokens.create).deliver_now
rescue
# Ignore errors sending email
end
@ -742,7 +742,7 @@ private
@user.errors.set(:email, [])
end
user.reset_email!
user.restore_email!
end
end
end