Fix an edge-edge case bug in journal_attributes_for_user with different users
In one case in a plugin (not able to reproduce in core) journal_attributes_for_user would set the :user to something different than what's in updated_by thus assigning the Journal to the wrong user.
This commit is contained in:
parent
db3480bdb6
commit
aa07982daa
@ -120,8 +120,8 @@ module Redmine::Acts::Journalized
|
|||||||
def journal_attributes
|
def journal_attributes
|
||||||
attributes = { :journaled_id => self.id, :activity_type => activity_type,
|
attributes = { :journaled_id => self.id, :activity_type => activity_type,
|
||||||
:changes => journal_changes, :version => last_version + 1,
|
:changes => journal_changes, :version => last_version + 1,
|
||||||
:notes => journal_notes, :user_id => (journal_user.try(:id) || User.current) }
|
:notes => journal_notes, :user_id => (journal_user.try(:id) || User.current.try(:id)) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -57,7 +57,7 @@ module Redmine::Acts::Journalized
|
|||||||
# Overrides the +journal_attributes+ method to include user information passed into the
|
# Overrides the +journal_attributes+ method to include user information passed into the
|
||||||
# parent object, by way of a +updated_by+ attr_accessor.
|
# parent object, by way of a +updated_by+ attr_accessor.
|
||||||
def journal_attributes_with_user
|
def journal_attributes_with_user
|
||||||
journal_attributes_without_user.merge(:user => updated_by || User.current)
|
journal_attributes_without_user.merge(:user_id => updated_by.try(:id) || User.current.try(:id))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user