Fixed Store/created_by_id handling.
This commit is contained in:
parent
dfe8a89f53
commit
679e260cde
4 changed files with 24 additions and 20 deletions
|
@ -36,11 +36,12 @@ class Observer::Ticket::Article::CommunicateEmail < ActiveRecord::Observer
|
||||||
|
|
||||||
# store mail plain
|
# store mail plain
|
||||||
Store.add(
|
Store.add(
|
||||||
:object => 'Ticket::Article::Mail',
|
:object => 'Ticket::Article::Mail',
|
||||||
:o_id => record.id,
|
:o_id => record.id,
|
||||||
:data => message.to_s,
|
:data => message.to_s,
|
||||||
:filename => "ticket-#{ticket.number}-#{record.id}.eml",
|
:filename => "ticket-#{ticket.number}-#{record.id}.eml",
|
||||||
:preferences => {}
|
:preferences => {},
|
||||||
|
:created_by_id => record.created_by_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
# add history record
|
# add history record
|
||||||
|
|
|
@ -216,11 +216,12 @@ class Package < ApplicationModel
|
||||||
record = Package.create( meta )
|
record = Package.create( meta )
|
||||||
if !data[:reinstall]
|
if !data[:reinstall]
|
||||||
Store.add(
|
Store.add(
|
||||||
:object => 'Package',
|
:object => 'Package',
|
||||||
:o_id => record.id,
|
:o_id => record.id,
|
||||||
:data => package.to_s,
|
:data => package.to_s,
|
||||||
:filename => meta[:name] + '-' + meta[:version] + '.zpm',
|
:filename => meta[:name] + '-' + meta[:version] + '.zpm',
|
||||||
:preferences => {},
|
:preferences => {},
|
||||||
|
:created_by_id => UserInfo.current_user_id || 1,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,12 @@ class Ticket::Article < ApplicationModel
|
||||||
article_store = []
|
article_store = []
|
||||||
self.attachments.each do |attachment|
|
self.attachments.each do |attachment|
|
||||||
article_store.push Store.add(
|
article_store.push Store.add(
|
||||||
:object => 'Ticket::Article',
|
:object => 'Ticket::Article',
|
||||||
:o_id => self.id,
|
:o_id => self.id,
|
||||||
:data => attachment.store_file.data,
|
:data => attachment.store_file.data,
|
||||||
:filename => attachment.filename,
|
:filename => attachment.filename,
|
||||||
:preferences => attachment.preferences
|
:preferences => attachment.preferences,
|
||||||
|
:created_by_id => self.created_by_id,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
self.attachments = article_store
|
self.attachments = article_store
|
||||||
|
|
|
@ -25,11 +25,12 @@ class StoreTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# add attachments
|
# add attachments
|
||||||
store = Store.add(
|
store = Store.add(
|
||||||
:object => 'Test',
|
:object => 'Test',
|
||||||
:o_id => 1,
|
:o_id => 1,
|
||||||
:data => file[:data],
|
:data => file[:data],
|
||||||
:filename => file[:filename],
|
:filename => file[:filename],
|
||||||
:preferences => {}
|
:preferences => {},
|
||||||
|
:created_by_id => 1,
|
||||||
)
|
)
|
||||||
assert store
|
assert store
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue