From 2a94c61a3e043579233c56a08a7540e9271ed12f Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Tue, 23 Dec 2014 17:37:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug(=E9=A1=B9=E7=9B=AE--?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=EF=BC=9A=E6=9B=B4=E6=96=B0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=97=B6=E5=9C=A8=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95=E4=B8=AD?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=9B=B8=E5=85=B3=E8=AE=B0=E5=BD=95=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=9B=BE=E7=89=87=E5=8F=AA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E4=B9=9F?= =?UTF-8?q?=E4=B8=8D=E5=90=88=E7=90=86)=20Signed-off-by:=20alan=20<5475334?= =?UTF-8?q?34@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/issues_helper.rb | 4 ++-- app/models/issue.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index dfa485a70..8390fc61c 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -227,7 +227,7 @@ module IssuesHelper strings = [] values_by_field = {} details.each do |detail| - unless detail.property == 'attachment' + if detail.property == 'cf' field_id = detail.prop_key field = CustomField.find_by_id(field_id) @@ -243,7 +243,7 @@ module IssuesHelper end end strings << show_detail(detail, no_html, options) - end + end values_by_field.each do |field_id, changes| detail = JournalDetail.new(:property => 'cf', :prop_key => field_id) diff --git a/app/models/issue.rb b/app/models/issue.rb index 09e093177..4dc685b3b 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -51,7 +51,7 @@ class Issue < ActiveRecord::Base acts_as_nested_set :scope => 'root_id', :dependent => :destroy - acts_as_attachable :after_add => :attachment_added, :after_remove => :attachment_removed + acts_as_attachable :before_add => :attachment_added, :after_remove => :attachment_removed acts_as_customizable acts_as_watchable acts_as_searchable :columns => ['subject', "#{table_name}.description", "#{Journal.table_name}.notes"], @@ -1359,7 +1359,7 @@ class Issue < ActiveRecord::Base # Callback on file attachment def attachment_added(obj) - if @current_journal && !obj.new_record? && @current_journal.journalized_id == obj.author_id + if @current_journal && @current_journal.user_id == obj.author_id && JournalDetail.find_all_by_value(obj.filename).count == 0 @current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename) end end