Skip to content

Commit

Permalink
document details of failing deletions
Browse files Browse the repository at this point in the history
  • Loading branch information
bkiahstroud committed Dec 24, 2024
1 parent 98a87f2 commit 9645bc5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/transactions/ams/steps/handle_contributors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,15 @@ def create_or_update_contributions(change_set, contributions)
param_contributor[:admin_set_id] = change_set['admin_set_id']
param_contributor[:title] = change_set["title"]

# FIXME: removing members this way doesn't work. The form does not pass _destroy, it simply
# doesn't pass the params for the contributor if it was removed. This is because the "Remove"
# button deletes the outer HTML of the input fields.
# Consider updating members by setting them equal to the contributors passed by params,
# effectively removing the members that were not passed.
# Importing / batch ingesting may handle deletion differently; verify whatever change made
# here works with those features
to_destroy = ActiveModel::Type::Boolean.new.cast(param_contributor['_destroy'])
if to_destroy
# FIXME: removing the member doesn't seem to work, destroy instead of unlink?
destroys << param_contributor[:id]
next
end
Expand All @@ -57,12 +63,6 @@ def create_or_update_contributions(change_set, contributions)
Hyrax.publisher.publish('object.metadata.updated', object: contributor_resource, user: user)
inserts << contributor_resource.id
else
# param_contributor.slice(:contributor_role, :contributor, :affiliation, :portrayal).each do |attr, value|
# contributor.send("#{attr}=", value)
# end
# Hyrax.persister.save(resource: contributor)
# Hyrax.index_adapter.save(resource: contribution)
# Hyrax.publisher.publish('object.metadata.updated', object: contributor, user: user)
contribution_form = Hyrax::Forms::ResourceForm.for(contributor)
sanitized_params = param_contributor.slice(:contributor_role, :contributor, :affiliation, :portrayal)
contribution_form.validate(sanitized_params)
Expand Down

0 comments on commit 9645bc5

Please sign in to comment.