Skip to content

Commit

Permalink
Merge pull request #1911 from datadryad/bug-fix2
Browse files Browse the repository at this point in the history
Reduce error report emails
  • Loading branch information
alinvetian authored Nov 6, 2024
2 parents 4855981 + 10530dc commit 4bf8886
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/stash_engine/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class DashboardController < ApplicationController
MAX_VALIDATION_TRIES = 5

def choose
return redirect_to admin_dashboard_path if current_user.min_admin?
return redirect_to admin_dashboard_path if current_user&.min_admin?

redirect_to dashboard_path
end
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/stash_engine/journal_admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def update_issns
@journal.issns.where.not(id: issns).destroy_all
issns.reject { |id| @journal.issns.map(&:id).include?(id) }.each { |issn| StashEngine::JournalIssn.create(id: issn, journal_id: @journal.id) }
@journal.reload
rescue ActiveRecord::RecordNotUnique
@error_message = 'Journal ISSN is already in use'
render :update_error
end

def edit_params
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/stash_engine/landing_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def ensure_has_geolocation!
end

def identifier_from(params)
logger.error("Can't parse identifier from nil id param") && return unless params[:id].present?

params.require(:id)
id_param = params[:id].upcase
type, id = id_param.split(':', 2)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/stash_engine/metadata_entry_pages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def duplicate_resource
begin
@new_res = @resource.amoeba_dup
rescue ActiveRecord::RecordNotUnique
@new_res = @resource.identifier.lastest_resource unless @resource.identifier.lastest_resource_id == @resource.id
@new_res = @resource.identifier.latest_resource unless @resource.identifier.latest_resource_id == @resource.id
@new_res ||= @resource.amoeba_dup
end
@new_res.current_editor_id = current_user&.id
Expand Down
2 changes: 1 addition & 1 deletion app/views/stash_engine/dashboard/_user_datasets.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<% end %>
<% end %>
<% if dataset.sort_order == 1 %>
<%= button_to stash_url_helpers.peer_review_release_path, method: :patch, params: {stash_engine_resource: { id: daatset.id }}, name: 'release', data: { confirm: 'Is this dataset ready for curation and publication?' }, form_class: 'o-button__inline-form', class: 'o-button__plain-text7' do %>
<%= button_to stash_url_helpers.peer_review_release_path, method: :patch, params: {stash_engine_resource: { id: dataset.id }}, name: 'release', data: { confirm: 'Is this dataset ready for curation and publication?' }, form_class: 'o-button__inline-form', class: 'o-button__plain-text7' do %>
Release for curation <i class="fa fa-paper-plane" aria-hidden="true"></i>
<% end %>
<% end %>
Expand Down
1 change: 1 addition & 0 deletions app/views/stash_engine/journal_admin/update_error.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
document.getElementById('genericModalContent').innerHTML = '<h1>Update error!</h1><%= escape_javascript(@error_message) %>';

0 comments on commit 4bf8886

Please sign in to comment.