diff --git a/CHANGELOG.md b/CHANGELOG.md index fc707cca89..4a390f37d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Updated emails's language is based on user's choice on UI, instead of system default [196](https://github.com/portagenetwork/roadmap/issues/196) + - Issue with 500 page error resue on Logo isseus on update of Organizations [327](https://github.com/portagenetwork/roadmap/issues/327) and [354](https://github.com/portagenetwork/roadmap/issues/354) ## [3.1.0+portage-3.1.3] - 2023-06-13 diff --git a/app/controllers/orgs_controller.rb b/app/controllers/orgs_controller.rb index ed0e3f78df..8ed2be0e2f 100644 --- a/app/controllers/orgs_controller.rb +++ b/app/controllers/orgs_controller.rb @@ -77,21 +77,25 @@ def admin_update # Remove the extraneous Org Selector hidden fields attrs = remove_org_selection_params(params_in: attrs) - - if @org.update(attrs) - # Save any identifiers that were found - if current_user.can_super_admin? && lookup.present? - # Loop through the identifiers and then replace the existing - # identifier and save the new one - identifiers.each do |id| - @org = process_identifier_change(org: @org, identifier: id) + begin + if @org.update(attrs) + # Save any identifiers that were found + if current_user.can_super_admin? && lookup.present? + # Loop through the identifiers and then replace the existing + # identifier and save the new one + identifiers.each do |id| + @org = process_identifier_change(org: @org, identifier: id) + end + @org.save end - @org.save + redirect_to "#{admin_edit_org_path(@org)}##{tab}", + notice: success_message(@org, _('saved')) + else + failure = failure_message(@org, _('save')) if failure.blank? + redirect_to "#{admin_edit_org_path(@org)}##{tab}", alert: failure end - redirect_to "#{admin_edit_org_path(@org)}##{tab}", - notice: success_message(@org, _('saved')) - else - failure = failure_message(@org, _('save')) if failure.blank? + rescue Dragonfly::Job::Fetch::NotFound + failure = _('There seems to be a problem with your logo. Please upload it again.') redirect_to "#{admin_edit_org_path(@org)}##{tab}", alert: failure end end