Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/datacite/lupo
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Sep 1, 2018
2 parents 91162ae + 660508f commit d6137b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,12 @@ def update
exists = @doi.present?

if exists
if safe_params[:xml].present? || safe_params[:url].present? || safe_params[:event].present?
if params[:data][:attributes][:mode] == "transfer"
authorize! :transfer, @doi
elsif safe_params[:xml].present? || safe_params[:url].present? || safe_params[:event].present?
authorize! :update, @doi
else
authorize! :transfer, @doi
fail ActionController::ParameterMissing
end

@doi.assign_attributes(safe_params.except(:doi))
Expand Down Expand Up @@ -391,7 +393,7 @@ def safe_params
last_landing_page_status: p["last-landing-page-status"],
last_landing_page_status_check: p["last-landing-page-status-check"],
last_landing_page_content_type: p["last-landing-page-content-type"]
).except("confirm-doi", :identifier, :prefix, :suffix, "resource-type-subtype", "metadata-version", "schema-version", :state, "is-active", :created, :registered, :updated, :mode, "last-landing-page", "last-landing-page-status", "last-landing-page-status-check", "last-landing-page-content-type")
).except("confirm-doi", :identifier, :prefix, :suffix, "resource-type-subtype", "metadata-version", "schema-version", :state, :mode, "is-active", :created, :registered, :updated, "last-landing-page", "last-landing-page-status", "last-landing-page-status-check", "last-landing-page-content-type")
end

def underscore_str(str)
Expand Down
3 changes: 1 addition & 2 deletions spec/fixtures/files/transfer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"event": null,
"created": "2018-08-29T13:45:34.000Z",
"registered": "2018-08-29T14:07:53.000Z",
"updated": "2018-08-29T14:07:53.000Z",
"mode": "transfer"
"updated": "2018-08-29T14:07:53.000Z"
},
"relationships": {
"client": {
Expand Down
1 change: 1 addition & 0 deletions spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@
"data" => {
"type" => "dois",
"attributes" => {
"mode" => "transfer"
},
"relationships"=> {
"client"=> {
Expand Down

0 comments on commit d6137b1

Please sign in to comment.