修改bug(项目--缺陷:更新图片时在历史记录中没有相关记录,删除图片只显示一个更新时间也不合理)

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2014-12-23 17:37:45 +08:00
parent b8e00e16df
commit 2a94c61a3e
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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