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
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
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
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)
@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
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
# 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']
# 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 } :
# 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]
# 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 }
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'
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
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
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
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",
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
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]
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
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