* Allow for skipping navigation link creation This commit provides a possible solution for preventing the re-creation of a navigation link deleted by a Forem creator. What I need is a discussion around the life-cycle of the application installation and updates. In particular, does this provide a robust enough mechanism for resolving the issue at hand? _Note: it pains me to ask about a user's role, but this is provided as a point of discussion and possible implementationi to address the underlying issue. But I'm referencing a constant in the Rake task so hopefully that will help future refactors. Also, it's one reason I needed to remove the `private_constant` declaration._ If we accept this code change, a future task is to document the ENV and behavior. Closes #15960 **Further considerations**: - How might we refine this to not be as "role" reliant? - Could we have a Site::Setting that we enable/disable regarding the navigation links? Regarding QA: - Start from an empty database - Run setup - Verify Navigation Link exists - Delete Navigation Link - Run setup again - Verify Navigation Link exists (because we don't have a user) - Run seeds - Delete Navigation Link - Run setup again - Verify Navigation Link exists (because we don't have a user) ```shell $ cd ./path/to/forem/repo $ rails db:drop db:create db:schema:load $ bin/setup $ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?" => true $ bin/rails runner "NavigationLink.where(url: '/readinglist').delete_all" $ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?" => false $ bin/setup $ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?" => true $ bin/rails db:seed $ bin/rails runner "NavigationLink.where(url: '/readinglist').delete_all" $ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?" => false $ bin/setup $ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"c => false ``` * Bump for travis |
||
|---|---|---|
| .. | ||
| temporary | ||
| add_navigation_links.rake | ||
| app_initializer.rake | ||
| assets.rake | ||
| badges.rake | ||
| cache.rake | ||
| data_updates.rake | ||
| e2e_seed.rake | ||
| fastly.rake | ||
| fetch.rake | ||
| forem.rake | ||
| metrics.rake | ||
| pages.rake | ||
| post_precompile_assets.rake | ||