Removes "xxx and return" calls (#4446).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3185 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0e4525d76c
commit
488c192286
|
@ -67,9 +67,9 @@ class AccountController < ApplicationController
|
||||||
if request.post?
|
if request.post?
|
||||||
user = User.find_by_mail(params[:mail])
|
user = User.find_by_mail(params[:mail])
|
||||||
# user not found in db
|
# user not found in db
|
||||||
flash.now[:error] = l(:notice_account_unknown_email) and return unless user
|
(flash.now[:error] = l(:notice_account_unknown_email); return) unless user
|
||||||
# user uses an external authentification
|
# user uses an external authentification
|
||||||
flash.now[:error] = l(:notice_can_t_change_password) and return if user.auth_source_id
|
(flash.now[:error] = l(:notice_can_t_change_password); return) if user.auth_source_id
|
||||||
# create a new token for password recovery
|
# create a new token for password recovery
|
||||||
token = Token.new(:user => user, :action => "recovery")
|
token = Token.new(:user => user, :action => "recovery")
|
||||||
if token.save
|
if token.save
|
||||||
|
|
|
@ -30,7 +30,8 @@ class ApplicationController < ActionController::Base
|
||||||
def delete_broken_cookies
|
def delete_broken_cookies
|
||||||
if cookies['_redmine_session'] && cookies['_redmine_session'] !~ /--/
|
if cookies['_redmine_session'] && cookies['_redmine_session'] !~ /--/
|
||||||
cookies.delete '_redmine_session'
|
cookies.delete '_redmine_session'
|
||||||
redirect_to home_path and return false
|
redirect_to home_path
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -166,7 +167,8 @@ class ApplicationController < ActionController::Base
|
||||||
uri = URI.parse(back_url)
|
uri = URI.parse(back_url)
|
||||||
# do not redirect user to another host or to the login or register page
|
# do not redirect user to another host or to the login or register page
|
||||||
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
|
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
|
||||||
redirect_to(back_url) and return
|
redirect_to(back_url)
|
||||||
|
return
|
||||||
end
|
end
|
||||||
rescue URI::InvalidURIError
|
rescue URI::InvalidURIError
|
||||||
# redirect to default
|
# redirect to default
|
||||||
|
|
|
@ -32,7 +32,7 @@ class CustomFieldsController < ApplicationController
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
redirect_to(:action => 'index') and return unless @custom_field.is_a?(CustomField)
|
(redirect_to(:action => 'index'); return) unless @custom_field.is_a?(CustomField)
|
||||||
|
|
||||||
if request.post? and @custom_field.save
|
if request.post? and @custom_field.save
|
||||||
flash[:notice] = l(:notice_successful_create)
|
flash[:notice] = l(:notice_successful_create)
|
||||||
|
|
|
@ -475,7 +475,8 @@ private
|
||||||
@project = projects.first
|
@project = projects.first
|
||||||
else
|
else
|
||||||
# TODO: let users bulk edit/move/destroy issues from different projects
|
# TODO: let users bulk edit/move/destroy issues from different projects
|
||||||
render_error 'Can not bulk edit/move/destroy issues from different projects' and return false
|
render_error 'Can not bulk edit/move/destroy issues from different projects'
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render_404
|
render_404
|
||||||
|
|
|
@ -33,7 +33,7 @@ class JournalsController < ApplicationController
|
||||||
private
|
private
|
||||||
def find_journal
|
def find_journal
|
||||||
@journal = Journal.find(params[:id])
|
@journal = Journal.find(params[:id])
|
||||||
render_403 and return false unless @journal.editable_by?(User.current)
|
(render_403; return false) unless @journal.editable_by?(User.current)
|
||||||
@project = @journal.journalized.project
|
@project = @journal.journalized.project
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render_404
|
render_404
|
||||||
|
|
|
@ -68,7 +68,7 @@ class MessagesController < ApplicationController
|
||||||
|
|
||||||
# Edit a message
|
# Edit a message
|
||||||
def edit
|
def edit
|
||||||
render_403 and return false unless @message.editable_by?(User.current)
|
(render_403; return false) unless @message.editable_by?(User.current)
|
||||||
if params[:message]
|
if params[:message]
|
||||||
@message.locked = params[:message]['locked']
|
@message.locked = params[:message]['locked']
|
||||||
@message.sticky = params[:message]['sticky']
|
@message.sticky = params[:message]['sticky']
|
||||||
|
@ -83,7 +83,7 @@ class MessagesController < ApplicationController
|
||||||
|
|
||||||
# Delete a messages
|
# Delete a messages
|
||||||
def destroy
|
def destroy
|
||||||
render_403 and return false unless @message.destroyable_by?(User.current)
|
(render_403; return false) unless @message.destroyable_by?(User.current)
|
||||||
@message.destroy
|
@message.destroy
|
||||||
redirect_to @message.parent.nil? ?
|
redirect_to @message.parent.nil? ?
|
||||||
{ :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } :
|
{ :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } :
|
||||||
|
|
|
@ -78,7 +78,11 @@ class MyController < ApplicationController
|
||||||
# Manage user's password
|
# Manage user's password
|
||||||
def password
|
def password
|
||||||
@user = User.current
|
@user = User.current
|
||||||
flash[:error] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
|
if @user.auth_source_id
|
||||||
|
flash[:error] = l(:notice_can_t_change_password)
|
||||||
|
redirect_to :action => 'account'
|
||||||
|
return
|
||||||
|
end
|
||||||
if request.post?
|
if request.post?
|
||||||
if @user.check_password?(params[:password])
|
if @user.check_password?(params[:password])
|
||||||
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
||||||
|
@ -116,7 +120,7 @@ class MyController < ApplicationController
|
||||||
# params[:block] : id of the block to add
|
# params[:block] : id of the block to add
|
||||||
def add_block
|
def add_block
|
||||||
block = params[:block].to_s.underscore
|
block = params[:block].to_s.underscore
|
||||||
render(:nothing => true) and return unless block && (BLOCKS.keys.include? block)
|
(render :nothing => true; return) unless block && (BLOCKS.keys.include? block)
|
||||||
@user = User.current
|
@user = User.current
|
||||||
# remove if already present in a group
|
# remove if already present in a group
|
||||||
%w(top left right).each {|f| (session[:page_layout][f] ||= []).delete block }
|
%w(top left right).each {|f| (session[:page_layout][f] ||= []).delete block }
|
||||||
|
|
|
@ -73,7 +73,7 @@ class RepositoriesController < ApplicationController
|
||||||
if request.xhr?
|
if request.xhr?
|
||||||
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
|
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
|
||||||
else
|
else
|
||||||
show_error_not_found and return unless @entries
|
(show_error_not_found; return) unless @entries
|
||||||
@changesets = @repository.latest_changesets(@path, @rev)
|
@changesets = @repository.latest_changesets(@path, @rev)
|
||||||
@properties = @repository.properties(@path, @rev)
|
@properties = @repository.properties(@path, @rev)
|
||||||
render :action => 'show'
|
render :action => 'show'
|
||||||
|
@ -84,7 +84,7 @@ class RepositoriesController < ApplicationController
|
||||||
|
|
||||||
def changes
|
def changes
|
||||||
@entry = @repository.entry(@path, @rev)
|
@entry = @repository.entry(@path, @rev)
|
||||||
show_error_not_found and return unless @entry
|
(show_error_not_found; return) unless @entry
|
||||||
@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
|
@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
|
||||||
@properties = @repository.properties(@path, @rev)
|
@properties = @repository.properties(@path, @rev)
|
||||||
end
|
end
|
||||||
|
@ -107,13 +107,13 @@ class RepositoriesController < ApplicationController
|
||||||
|
|
||||||
def entry
|
def entry
|
||||||
@entry = @repository.entry(@path, @rev)
|
@entry = @repository.entry(@path, @rev)
|
||||||
show_error_not_found and return unless @entry
|
(show_error_not_found; return) unless @entry
|
||||||
|
|
||||||
# If the entry is a dir, show the browser
|
# If the entry is a dir, show the browser
|
||||||
show and return if @entry.is_dir?
|
(show; return) if @entry.is_dir?
|
||||||
|
|
||||||
@content = @repository.cat(@path, @rev)
|
@content = @repository.cat(@path, @rev)
|
||||||
show_error_not_found and return unless @content
|
(show_error_not_found; return) unless @content
|
||||||
if 'raw' == params[:format] || @content.is_binary_data? || (@entry.size && @entry.size > Setting.file_max_size_displayed.to_i.kilobyte)
|
if 'raw' == params[:format] || @content.is_binary_data? || (@entry.size && @entry.size > Setting.file_max_size_displayed.to_i.kilobyte)
|
||||||
# Force the download
|
# Force the download
|
||||||
send_data @content, :filename => @path.split('/').last
|
send_data @content, :filename => @path.split('/').last
|
||||||
|
@ -125,10 +125,10 @@ class RepositoriesController < ApplicationController
|
||||||
|
|
||||||
def annotate
|
def annotate
|
||||||
@entry = @repository.entry(@path, @rev)
|
@entry = @repository.entry(@path, @rev)
|
||||||
show_error_not_found and return unless @entry
|
(show_error_not_found; return) unless @entry
|
||||||
|
|
||||||
@annotate = @repository.scm.annotate(@path, @rev)
|
@annotate = @repository.scm.annotate(@path, @rev)
|
||||||
render_error l(:error_scm_annotate) and return if @annotate.nil? || @annotate.empty?
|
(render_error l(:error_scm_annotate); return) if @annotate.nil? || @annotate.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def revision
|
def revision
|
||||||
|
@ -146,7 +146,7 @@ class RepositoriesController < ApplicationController
|
||||||
def diff
|
def diff
|
||||||
if params[:format] == 'diff'
|
if params[:format] == 'diff'
|
||||||
@diff = @repository.diff(@path, @rev, @rev_to)
|
@diff = @repository.diff(@path, @rev, @rev_to)
|
||||||
show_error_not_found and return unless @diff
|
(show_error_not_found; return) unless @diff
|
||||||
filename = "changeset_r#{@rev}"
|
filename = "changeset_r#{@rev}"
|
||||||
filename << "_r#{@rev_to}" if @rev_to
|
filename << "_r#{@rev_to}" if @rev_to
|
||||||
send_data @diff.join, :filename => "#{filename}.diff",
|
send_data @diff.join, :filename => "#{filename}.diff",
|
||||||
|
@ -199,7 +199,7 @@ private
|
||||||
def find_repository
|
def find_repository
|
||||||
@project = Project.find(params[:id])
|
@project = Project.find(params[:id])
|
||||||
@repository = @project.repository
|
@repository = @project.repository
|
||||||
render_404 and return false unless @repository
|
(render_404; return false) unless @repository
|
||||||
@path = params[:path].join('/') unless params[:path].nil?
|
@path = params[:path].join('/') unless params[:path].nil?
|
||||||
@path ||= ''
|
@path ||= ''
|
||||||
@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].strip
|
@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].strip
|
||||||
|
|
|
@ -209,7 +209,7 @@ class TimelogController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
render_403 and return if @time_entry && !@time_entry.editable_by?(User.current)
|
(render_403; return) if @time_entry && !@time_entry.editable_by?(User.current)
|
||||||
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)
|
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today)
|
||||||
@time_entry.attributes = params[:time_entry]
|
@time_entry.attributes = params[:time_entry]
|
||||||
|
|
||||||
|
@ -223,8 +223,8 @@ class TimelogController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
render_404 and return unless @time_entry
|
(render_404; return) unless @time_entry
|
||||||
render_403 and return unless @time_entry.editable_by?(User.current)
|
(render_403; return) unless @time_entry.editable_by?(User.current)
|
||||||
@time_entry.destroy
|
@time_entry.destroy
|
||||||
flash[:notice] = l(:notice_successful_delete)
|
flash[:notice] = l(:notice_successful_delete)
|
||||||
redirect_to :back
|
redirect_to :back
|
||||||
|
|
|
@ -183,7 +183,8 @@ class WikiController < ApplicationController
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
# requested special page doesn't exist, redirect to default page
|
# requested special page doesn't exist, redirect to default page
|
||||||
redirect_to :action => 'index', :id => @project, :page => nil and return
|
redirect_to :action => 'index', :id => @project, :page => nil
|
||||||
|
return
|
||||||
end
|
end
|
||||||
render :action => "special_#{page_title}"
|
render :action => "special_#{page_title}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue