diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-03-04 16:18:51 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-03-04 16:18:51 +0000 |
commit | c58dc83e74f2c4d234e870335172f7bd04a0e2a9 (patch) | |
tree | 7e221547b8418759f67e1d67b715027d0eb9fc4e /app/controllers | |
parent | 7514e12d331bea026155df6cdc2b68df8b77d7b1 (diff) | |
download | redmine-c58dc83e74f2c4d234e870335172f7bd04a0e2a9.tar.gz redmine-c58dc83e74f2c4d234e870335172f7bd04a0e2a9.zip |
Refactor: Replace @journal with @issue.current_journal
This removes an instance variable in #issue_update which will let it be moved
to the Issue model.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3540 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/issues_controller.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 6c71219bf..4279846b5 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -188,6 +188,8 @@ class IssuesController < ApplicationController def edit update_issue_from_params + @journal = @issue.current_journal + respond_to do |format| format.html { } format.xml { } @@ -203,6 +205,7 @@ class IssuesController < ApplicationController format.xml { head :ok } end else + @journal = @issue.current_journal respond_to do |format| format.html { render :action => 'edit' } format.xml { render :xml => @issue.errors, :status => :unprocessable_entity } @@ -549,7 +552,7 @@ private @time_entry = TimeEntry.new @notes = params[:notes] - @journal = @issue.init_journal(User.current, @notes) + @issue.init_journal(User.current, @notes) # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue] attrs = params[:issue].dup @@ -573,14 +576,14 @@ private attachments = Attachment.attach_files(@issue, params[:attachments]) render_attachment_warning_if_needed(@issue) - attachments[:files].each {|a| @journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)} - call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal}) + attachments[:files].each {|a| @issue.current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => a.id, :value => a.filename)} + call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @issue.current_journal}) if @issue.save - if !@journal.new_record? + if !@issue.current_journal.new_record? # Only send notification if something was actually changed flash[:notice] = l(:notice_successful_update) end - call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @journal}) + call_hook(:controller_issues_edit_after_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => @issue.current_journal}) return true end end |