-
Notifications
You must be signed in to change notification settings - Fork 8
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
Allow events to trigger on specific conditions #1052
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work Ashwini :)
changed_attributes = saved_changes | ||
relevant_changes = changed_attributes.keys & %w[related_identifiers creators funding_references aasm_state] | ||
send_import_message(to_jsonapi) if relevant_changes.any? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this refactor away from an ever-increasing list of boolean clauses, very elegant!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @digitaldogsbody :)
Also saved_change_to_attribute?
this method only execute when we have update
call, so we never captured the create
DOI call before because of this method checks.
We missed the events for the DOI which are created directly with findable
state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saved_changes
will work for both create
and update
action.
Purpose
Events not created when DOI first created in registered or draft state
closes: datacite/datacite#1710
Approach
Events should be created at following conditions,
findable
statefindable
and there is an update in any of these fieldsrelated_identifiers
,creators
,funding_references
any other state
tofindable
Open Questions and Pre-Merge TODOs
Learning
Types of changes
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to change)
Reviewer, please remember our guidelines: