Skip to content

Commit

Permalink
don't update affiliations if only 'id' sent in params
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Jun 27, 2023
1 parent 3375586 commit 1394de9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/agents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def update_identifiers(identifiers)
identifier = LinkedData::Models::AgentIdentifier.new unless identifier

i.delete "id"

return identifier if i.keys.size.zero?

populate_from_params(identifier, i)

if identifier.valid?
Expand All @@ -82,6 +85,8 @@ def update_affiliations(affiliations)
Array(affiliations).map do |aff|
affiliation = aff["id"] ? LinkedData::Models::Agent.find(RDF::URI.new(aff["id"])).first : nil

return affiliation if aff.keys.size.eql?(1) && aff["id"]

if affiliation
affiliation.bring_remaining
affiliation = update_agent(affiliation, aff)
Expand Down

0 comments on commit 1394de9

Please sign in to comment.