OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix WikiPage#destroy when destroying child, then parent
Oliver Günther1f6288233190
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rbindex 9d5f58bcb74..885f23eab0b 100644--- a/app/models/wiki_page.rb+++ b/app/models/wiki_page.rb@@ -93,6 +93,18 @@ class WikiPage < ApplicationRecordtitle.to_localized_slug(locale: :en)end+ # Using a hook will not allow us to retry the call+ # rubocop:disable Rails/ActiveRecordOverride+ def destroy+ super+ rescue ActiveRecord::StaleObjectError+ # Due to closure_tree, parent_id might have changed+ # when destroying all wiki pages+ reload+ super+ end+ # rubocop:enable Rails/ActiveRecordOverride+def delete_wiki_menu_itemmenu_item&.destroy# ensure there is a menu item for the wiki