summaryrefslogtreecommitdiffstats
path: root/app/controllers/issues_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/issues_controller.rb')
-rw-r--r--app/controllers/issues_controller.rb30
1 files changed, 10 insertions, 20 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 31cc6ae7d..56a9b11ca 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -72,8 +72,15 @@ class IssuesController < ApplicationController
unless params[:notes].empty?
journal = @issue.init_journal(self.logged_in_user, params[:notes])
if @issue.save
+ params[:attachments].each { |file|
+ next unless file.size > 0
+ a = Attachment.create(:container => @issue, :file => file, :author => logged_in_user)
+ journal.details << JournalDetail.new(:property => 'attachment',
+ :prop_key => a.id,
+ :value => a.filename) unless a.new_record?
+ } if params[:attachments] and params[:attachments].is_a? Array
flash[:notice] = l(:notice_successful_update)
- Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
+ Mailer.deliver_issue_edit(journal) #if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
redirect_to :action => 'show', :id => @issue
return
end
@@ -100,14 +107,14 @@ class IssuesController < ApplicationController
} if params[:attachments] and params[:attachments].is_a? Array
# Log time
- if logged_in_user.authorized_to(@project, "timelog/edit")
+ if current_role.allowed_to?(:log_time)
@time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => logged_in_user, :spent_on => Date.today)
@time_entry.attributes = params[:time_entry]
@time_entry.save
end
flash[:notice] = l(:notice_successful_update)
- Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
+ Mailer.deliver_issue_edit(journal) #if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
redirect_to :action => 'show', :id => @issue
end
rescue ActiveRecord::StaleObjectError
@@ -124,23 +131,6 @@ class IssuesController < ApplicationController
redirect_to :controller => 'projects', :action => 'list_issues', :id => @project
end
- def add_attachment
- # Save the attachments
- @attachments = []
- journal = @issue.init_journal(self.logged_in_user)
- params[:attachments].each { |file|
- next unless file.size > 0
- a = Attachment.create(:container => @issue, :file => file, :author => logged_in_user)
- @attachments << a unless a.new_record?
- journal.details << JournalDetail.new(:property => 'attachment',
- :prop_key => a.id,
- :value => a.filename) unless a.new_record?
- } if params[:attachments] and params[:attachments].is_a? Array
- journal.save if journal.details.any?
- Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
- redirect_to :action => 'show', :id => @issue
- end
-
def destroy_attachment
a = @issue.attachments.find(params[:attachment_id])
a.destroy