Skip to content

Fix destroying scope types that have been associated with processes#10496

Merged
alecslupu merged 1 commit intodecidim:developfrom
mainio:fix/dynamic-scope-type-association-restrictions
Mar 13, 2023
Merged

Fix destroying scope types that have been associated with processes#10496
alecslupu merged 1 commit intodecidim:developfrom
mainio:fix/dynamic-scope-type-association-restrictions

Conversation

@ahukkanen
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen commented Mar 9, 2023

🎩 What? Why?

When processes are mapped to scope types, destroying the scope type causes a HTTP 500 error due to the foreign key violation caused by the association.

This only applies to the Decidim::ParticipatoryProcess model right now but this PR fixes it in a way that will fix the problem for any models potentially mapped to the Decidim::ScopeType model using the belongs_to association. See the added code comments for further explanation.

📌 Related Issues

Testing

  • Run the spec that is added in this PR
  • Repeat running the same spec without this fix (e.g. comment out the before_destroy hook), you should see the same error as in the bug report

For instructions how to replicate from the UI, see #10490.

@alecslupu alecslupu merged commit 78989a8 into decidim:develop Mar 13, 2023
@ahukkanen ahukkanen deleted the fix/dynamic-scope-type-association-restrictions branch March 13, 2023 09:44
entantoencuanto added a commit that referenced this pull request Mar 23, 2023
…ent-blocks

* feature/redesign: (97 commits)
  Feature/redesign accountability versions (#10517)
  Redesign: add image to blog item (#10458)
  Redesign: search results (#10380)
  Fix test
  Finalize word standardization (#10557)
  Fix iframes stripped from admin entered proposals, meetings and debates (#10466)
  Fix ImageMagick errors when trying to identify image dimensions (#10343)
  Add required to proposal limit field in Proposal component (#10525)
  Standardize the format of the words "is not" (#10511)
  Standardize the format of the words "has not" (#10510)
  Standardize the format of the words "will not" (#10509)
  Make buttons respect the organizations' primary color (#10526)
  Fix flaky spec for questionnaire templates (#10544)
  Remove the deprecated `optional` option from the file upload modal (#10542)
  Standardize the format of the words "does not" (#10505)
  Standardize the format of the words "was not" (#10514)
  Add Procfile support (#10519)
  Standardize the format of the words "do not" (#10513)
  Change the `optional` option to `required` at participatory texts (#10498)
  Fix destroying scope types that have been associated with processes (#10496)
  ...
entantoencuanto added a commit that referenced this pull request Mar 23, 2023
…le-card

* feature/redesign: (94 commits)
  Fix test
  Finalize word standardization (#10557)
  Fix iframes stripped from admin entered proposals, meetings and debates (#10466)
  Fix ImageMagick errors when trying to identify image dimensions (#10343)
  Add required to proposal limit field in Proposal component (#10525)
  Standardize the format of the words "is not" (#10511)
  Standardize the format of the words "has not" (#10510)
  Standardize the format of the words "will not" (#10509)
  Make buttons respect the organizations' primary color (#10526)
  Fix flaky spec for questionnaire templates (#10544)
  Remove the deprecated `optional` option from the file upload modal (#10542)
  Standardize the format of the words "does not" (#10505)
  Standardize the format of the words "was not" (#10514)
  Add Procfile support (#10519)
  Standardize the format of the words "do not" (#10513)
  Change the `optional` option to `required` at participatory texts (#10498)
  Fix destroying scope types that have been associated with processes (#10496)
  Fix dynamic upload file field required indicator + make option naming consistent (#10497)
  Standardize the format of the words "should not" (#10515)
  Standardize the format of the words "were not" (#10516)
  ...
entantoencuanto added a commit that referenced this pull request Mar 23, 2023
* feature/redesign: (94 commits)
  Fix test
  Finalize word standardization (#10557)
  Fix iframes stripped from admin entered proposals, meetings and debates (#10466)
  Fix ImageMagick errors when trying to identify image dimensions (#10343)
  Add required to proposal limit field in Proposal component (#10525)
  Standardize the format of the words "is not" (#10511)
  Standardize the format of the words "has not" (#10510)
  Standardize the format of the words "will not" (#10509)
  Make buttons respect the organizations' primary color (#10526)
  Fix flaky spec for questionnaire templates (#10544)
  Remove the deprecated `optional` option from the file upload modal (#10542)
  Standardize the format of the words "does not" (#10505)
  Standardize the format of the words "was not" (#10514)
  Add Procfile support (#10519)
  Standardize the format of the words "do not" (#10513)
  Change the `optional` option to `required` at participatory texts (#10498)
  Fix destroying scope types that have been associated with processes (#10496)
  Fix dynamic upload file field required indicator + make option naming consistent (#10497)
  Standardize the format of the words "should not" (#10515)
  Standardize the format of the words "were not" (#10516)
  ...
entantoencuanto added a commit that referenced this pull request Mar 23, 2023
* feature/redesign: (97 commits)
  Feature/redesign accountability versions (#10517)
  Redesign: add image to blog item (#10458)
  Redesign: search results (#10380)
  Fix test
  Finalize word standardization (#10557)
  Fix iframes stripped from admin entered proposals, meetings and debates (#10466)
  Fix ImageMagick errors when trying to identify image dimensions (#10343)
  Add required to proposal limit field in Proposal component (#10525)
  Standardize the format of the words "is not" (#10511)
  Standardize the format of the words "has not" (#10510)
  Standardize the format of the words "will not" (#10509)
  Make buttons respect the organizations' primary color (#10526)
  Fix flaky spec for questionnaire templates (#10544)
  Remove the deprecated `optional` option from the file upload modal (#10542)
  Standardize the format of the words "does not" (#10505)
  Standardize the format of the words "was not" (#10514)
  Add Procfile support (#10519)
  Standardize the format of the words "do not" (#10513)
  Change the `optional` option to `required` at participatory texts (#10498)
  Fix destroying scope types that have been associated with processes (#10496)
  ...
entantoencuanto added a commit that referenced this pull request Mar 23, 2023
…s-l-g

* feature/redesign: (97 commits)
  Feature/redesign accountability versions (#10517)
  Redesign: add image to blog item (#10458)
  Redesign: search results (#10380)
  Fix test
  Finalize word standardization (#10557)
  Fix iframes stripped from admin entered proposals, meetings and debates (#10466)
  Fix ImageMagick errors when trying to identify image dimensions (#10343)
  Add required to proposal limit field in Proposal component (#10525)
  Standardize the format of the words "is not" (#10511)
  Standardize the format of the words "has not" (#10510)
  Standardize the format of the words "will not" (#10509)
  Make buttons respect the organizations' primary color (#10526)
  Fix flaky spec for questionnaire templates (#10544)
  Remove the deprecated `optional` option from the file upload modal (#10542)
  Standardize the format of the words "does not" (#10505)
  Standardize the format of the words "was not" (#10514)
  Add Procfile support (#10519)
  Standardize the format of the words "do not" (#10513)
  Change the `optional` option to `required` at participatory texts (#10498)
  Fix destroying scope types that have been associated with processes (#10496)
  ...
entantoencuanto added a commit that referenced this pull request Mar 23, 2023
* feature/redesign: (97 commits)
  Feature/redesign accountability versions (#10517)
  Redesign: add image to blog item (#10458)
  Redesign: search results (#10380)
  Fix test
  Finalize word standardization (#10557)
  Fix iframes stripped from admin entered proposals, meetings and debates (#10466)
  Fix ImageMagick errors when trying to identify image dimensions (#10343)
  Add required to proposal limit field in Proposal component (#10525)
  Standardize the format of the words "is not" (#10511)
  Standardize the format of the words "has not" (#10510)
  Standardize the format of the words "will not" (#10509)
  Make buttons respect the organizations' primary color (#10526)
  Fix flaky spec for questionnaire templates (#10544)
  Remove the deprecated `optional` option from the file upload modal (#10542)
  Standardize the format of the words "does not" (#10505)
  Standardize the format of the words "was not" (#10514)
  Add Procfile support (#10519)
  Standardize the format of the words "do not" (#10513)
  Change the `optional` option to `required` at participatory texts (#10498)
  Fix destroying scope types that have been associated with processes (#10496)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL ForeignKeyViolation: ERROR when deleting a Sector type associate to a process

2 participants