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

Signed-off-by: alan <547533434@qq.com>
dev_chuangbin
alan 11 years ago
parent b8e00e16df
commit 2a94c61a3e

@ -227,7 +227,7 @@ module IssuesHelper
strings = [] strings = []
values_by_field = {} values_by_field = {}
details.each do |detail| details.each do |detail|
unless detail.property == 'attachment'
if detail.property == 'cf' if detail.property == 'cf'
field_id = detail.prop_key field_id = detail.prop_key
field = CustomField.find_by_id(field_id) field = CustomField.find_by_id(field_id)
@ -243,7 +243,7 @@ module IssuesHelper
end end
end end
strings << show_detail(detail, no_html, options) strings << show_detail(detail, no_html, options)
end
end end
values_by_field.each do |field_id, changes| values_by_field.each do |field_id, changes|
detail = JournalDetail.new(:property => 'cf', :prop_key => field_id) detail = JournalDetail.new(:property => 'cf', :prop_key => field_id)

@ -51,7 +51,7 @@ class Issue < ActiveRecord::Base
acts_as_nested_set :scope => 'root_id', :dependent => :destroy 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_customizable
acts_as_watchable acts_as_watchable
acts_as_searchable :columns => ['subject', "#{table_name}.description", "#{Journal.table_name}.notes"], acts_as_searchable :columns => ['subject', "#{table_name}.description", "#{Journal.table_name}.notes"],
@ -1359,7 +1359,7 @@ class Issue < ActiveRecord::Base
# Callback on file attachment # Callback on file attachment
def attachment_added(obj) 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) @current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename)
end end
end end

Loading…
Cancel
Save