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?
|
||||
user = User.find_by_mail(params[:mail])
|
||||
# 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
|
||||
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
|
||||
token = Token.new(:user => user, :action => "recovery")
|
||||
if token.save
|
||||
|
|
|
@ -30,7 +30,8 @@ class ApplicationController < ActionController::Base
|
|||
def delete_broken_cookies
|
||||
if cookies['_redmine_session'] && cookies['_redmine_session'] !~ /--/
|
||||
cookies.delete '_redmine_session'
|
||||
redirect_to home_path and return false
|
||||
redirect_to home_path
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -166,7 +167,8 @@ class ApplicationController < ActionController::Base
|
|||
uri = URI.parse(back_url)
|
||||
# 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)})
|
||||
redirect_to(back_url) and return
|
||||
redirect_to(back_url)
|
||||
return
|
||||
end
|
||||
rescue URI::InvalidURIError
|
||||
# redirect to default
|
||||
|
|
|
@ -32,7 +32,7 @@ class CustomFieldsController < ApplicationController
|
|||
end
|
||||
rescue
|
||||
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
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
|
|
|
@ -475,7 +475,8 @@ private
|
|||
@project = projects.first
|
||||
else
|
||||
# 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
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
|
|
|
@ -33,7 +33,7 @@ class JournalsController < ApplicationController
|
|||
private
|
||||
def find_journal
|
||||
@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
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
|
|
|
@ -68,7 +68,7 @@ class MessagesController < ApplicationController
|
|||
|
||||
# Edit a message
|
||||
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]
|
||||
@message.locked = params[:message]['locked']
|
||||
@message.sticky = params[:message]['sticky']
|
||||
|
@ -83,7 +83,7 @@ class MessagesController < ApplicationController
|
|||
|
||||
# Delete a messages
|
||||
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
|
||||
redirect_to @message.parent.nil? ?
|
||||
{ :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } :
|
||||
|
|
|
@ -78,7 +78,11 @@ class MyController < ApplicationController
|
|||
# Manage user's password
|
||||
def password
|
||||
@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 @user.check_password?(params[:password])
|
||||
@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
|
||||
def add_block
|
||||
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
|
||||
# remove if already present in a group
|
||||
%w(top left right).each {|f| (session[:page_layout][f] ||= []).delete block }
|
||||
|
|
|
@ -73,7 +73,7 @@ class RepositoriesController < ApplicationController
|
|||
if request.xhr?
|
||||
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
|
||||
else
|
||||
show_error_not_found and return unless @entries
|
||||
(show_error_not_found; return) unless @entries
|
||||
@changesets = @repository.latest_changesets(@path, @rev)
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
render :action => 'show'
|
||||
|
@ -84,7 +84,7 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
def changes
|
||||
@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)
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
end
|
||||
|
@ -107,13 +107,13 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
def entry
|
||||
@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
|
||||
show and return if @entry.is_dir?
|
||||
(show; return) if @entry.is_dir?
|
||||
|
||||
@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)
|
||||
# Force the download
|
||||
send_data @content, :filename => @path.split('/').last
|
||||
|
@ -125,10 +125,10 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
def annotate
|
||||
@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)
|
||||
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
|
||||
|
||||
def revision
|
||||
|
@ -146,7 +146,7 @@ class RepositoriesController < ApplicationController
|
|||
def diff
|
||||
if params[:format] == 'diff'
|
||||
@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 << "_r#{@rev_to}" if @rev_to
|
||||
send_data @diff.join, :filename => "#{filename}.diff",
|
||||
|
@ -199,7 +199,7 @@ private
|
|||
def find_repository
|
||||
@project = Project.find(params[:id])
|
||||
@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 ||= ''
|
||||
@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].strip
|
||||
|
|
|
@ -209,7 +209,7 @@ class TimelogController < ApplicationController
|
|||
end
|
||||
|
||||
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.attributes = params[:time_entry]
|
||||
|
||||
|
@ -223,8 +223,8 @@ class TimelogController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
render_404 and return unless @time_entry
|
||||
render_403 and return unless @time_entry.editable_by?(User.current)
|
||||
(render_404; return) unless @time_entry
|
||||
(render_403; return) unless @time_entry.editable_by?(User.current)
|
||||
@time_entry.destroy
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
redirect_to :back
|
||||
|
|
|
@ -183,7 +183,8 @@ class WikiController < ApplicationController
|
|||
return
|
||||
else
|
||||
# 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
|
||||
render :action => "special_#{page_title}"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue