From c34648137142e5fe555d0b0313553f3dc366ec4e Mon Sep 17 00:00:00 2001 From: yashu Date: Thu, 20 Jul 2023 13:55:56 -0400 Subject: [PATCH 1/3] Resuing 500 erro while logo is missin on update of Organization data --- app/controllers/orgs_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/orgs_controller.rb b/app/controllers/orgs_controller.rb index ed0e3f78df..9a6da9be6c 100644 --- a/app/controllers/orgs_controller.rb +++ b/app/controllers/orgs_controller.rb @@ -77,7 +77,7 @@ def admin_update # Remove the extraneous Org Selector hidden fields attrs = remove_org_selection_params(params_in: attrs) - + begin if @org.update(attrs) # Save any identifiers that were found if current_user.can_super_admin? && lookup.present? @@ -94,6 +94,10 @@ def admin_update failure = failure_message(@org, _('save')) if failure.blank? redirect_to "#{admin_edit_org_path(@org)}##{tab}", alert: failure end + 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 # rubocop:enable Metrics/AbcSize, Metrics/MethodLength # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity From 996bf596c573459f6d6a9d0198722f4a3cc5fbbd Mon Sep 17 00:00:00 2001 From: yashu Date: Thu, 20 Jul 2023 13:59:55 -0400 Subject: [PATCH 2/3] Correcint the dpaces indentations --- app/controllers/orgs_controller.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/controllers/orgs_controller.rb b/app/controllers/orgs_controller.rb index 9a6da9be6c..8ed2be0e2f 100644 --- a/app/controllers/orgs_controller.rb +++ b/app/controllers/orgs_controller.rb @@ -78,22 +78,22 @@ def admin_update # Remove the extraneous Org Selector hidden fields attrs = remove_org_selection_params(params_in: attrs) 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) + 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? - redirect_to "#{admin_edit_org_path(@org)}##{tab}", alert: failure - end 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 From 5571e8be557ebb6c77a20c1671f81b9d58f47920 Mon Sep 17 00:00:00 2001 From: yashu Date: Thu, 20 Jul 2023 14:04:49 -0400 Subject: [PATCH 3/3] added changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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