Fixed bug: received_merge Ticket history entry has timestamp of previous history entry.
This commit is contained in:
parent
d44b5afd19
commit
f3862de9fc
2 changed files with 14 additions and 0 deletions
|
@ -311,6 +311,12 @@ returns
|
|||
# quiet update of reassign of articles
|
||||
Ticket::Article.where(ticket_id: id).update_all(['ticket_id = ?', data[:ticket_id]]) # rubocop:disable Rails/SkipsModelValidations
|
||||
|
||||
# mark target ticket as updated
|
||||
# otherwise the "received_merge" history entry
|
||||
# will be the same as the last updated_at
|
||||
# which might be a long time ago
|
||||
target_ticket.updated_at = Time.zone.now
|
||||
|
||||
# add merge event to both ticket's history (Issue #2469 - Add information "Ticket merged" to History)
|
||||
target_ticket.history_log(
|
||||
'received_merge',
|
||||
|
|
|
@ -81,6 +81,14 @@ RSpec.describe Ticket, type: :model do
|
|||
context 'when merging' do
|
||||
let(:merge_user) { create(:user) }
|
||||
|
||||
before do
|
||||
# create target ticket early
|
||||
# to avoid a race condition
|
||||
# when creating the history entries
|
||||
target_ticket
|
||||
travel 5.minutes
|
||||
end
|
||||
|
||||
it 'creates history entries in both the origin ticket and the target ticket' do
|
||||
ticket.merge_to(ticket_id: target_ticket.id, user_id: merge_user.id)
|
||||
|
||||
|
|
Loading…
Reference in a new issue