Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't track changes or attempt to persist server-managed properties on file metadata nodes #1464

Merged
merged 2 commits into from
Jan 12, 2022

Conversation

cjcolvar
Copy link
Member

Upstream port of monkey-patch in Hyrax required for wings (samvera/hyrax#5320)

This PR introduces an attribute on properties in the metadata schemas called :server_managed. When this attribute is set to true on a property it allows a value to be set via the generated setter but the change isn't tracked by ActiveModel::Dirty and subsequently isn't sent to the server as part of the changed values when saving.

@@ -21,6 +21,6 @@ def self.legacy_ebucore_vocabulary
property :date_modified, predicate: ::RDF::Vocab::EBUCore.dateModified
property :byte_order, predicate: SweetJPLTerms.byteOrder
# This is a server-managed predicate which means Fedora does not let us change it.
property :file_hash, predicate: ::RDF::Vocab::PREMIS.hasMessageDigest
property :file_hash, predicate: ::RDF::Vocab::PREMIS.hasMessageDigest, server_managed: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm really into this pattern. 💯

Copy link
Member

@no-reply no-reply left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for picking this up and backporting!

this pattern is a lot nicer even than the hack in Wings. 🥇

Co-authored-by: tamsin johnson <tomjohnson@ucsb.edu>
@cjcolvar cjcolvar merged commit db9d833 into main Jan 12, 2022
@cjcolvar cjcolvar deleted the server_managed_properties branch January 12, 2022 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants