修改bug(项目--缺陷:更新图片时在历史记录中没有相关记录,删除图片只显示一个更新时间也不合理)
Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
parent
b8e00e16df
commit
2a94c61a3e
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue