[ARVADOS] updated: 1.3.0-2842-g977e50534
Git user
git at public.arvados.org
Mon Aug 3 22:28:17 UTC 2020
Summary of changes:
services/api/app/models/collection.rb | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
via 977e50534e492e6def8fec2bfb207a0b9f338a75 (commit)
from 71832447d72f309d539edee38afe3ce1ed9f34ed (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 977e50534e492e6def8fec2bfb207a0b9f338a75
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Mon Aug 3 19:24:00 2020 -0300
16470: Fixes collection versioning management code.
Collection versioning management is implemented on an 'around_update' callback
so some 'attribute_changed()' & 'changes()' calls changed behaviour depending
on which side of the 'yield' were made.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 8f724e1f5..c7d5a93b5 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -303,12 +303,18 @@ class Collection < ArvadosModel
def syncable_updates
updates = {}
- (syncable_attrs & self.changes.keys).each do |attr|
+ if self.changes.any?
+ changes = self.changes
+ else
+ # If called after save...
+ changes = self.saved_changes
+ end
+ (syncable_attrs & changes.keys).each do |attr|
if attr == 'uuid'
# Point old versions to current version's new UUID
- updates['current_version_uuid'] = self.changes[attr].last
+ updates['current_version_uuid'] = changes[attr].last
else
- updates[attr] = self.changes[attr].last
+ updates[attr] = changes[attr].last
end
end
return updates
@@ -316,7 +322,7 @@ class Collection < ArvadosModel
def sync_past_versions
updates = self.syncable_updates
- Collection.where('current_version_uuid = ? AND uuid != ?', self.uuid_was, self.uuid_was).each do |c|
+ Collection.where('current_version_uuid = ? AND uuid != ?', self.uuid_before_last_save, self.uuid_before_last_save).each do |c|
c.attributes = updates
# Use a different validation context to skip the 'past_versions_cannot_be_updated'
# validator, as on this case it is legal to update some fields.
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list