Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Where
What
Adds "Drafting" phase to Budgets. Budgets in drafting phase can only be listed/viewed by admins.
How
Adding
description_drafting
& drafting phase to Budget model d0937d7 & f9803ceCreating a
budget_published?
helper method at BudgetHelper 03f4fce to use it on both BudgetController to raise a 404 error 76e05d5 and at public budget lists 4916f9a to decide if it should be accessible or not by current user.Screenshots
A Gif is worth a thousand Screenshots!
In this gif we:
Test
Created a "Drafting phase" scenario for Budget feature spec that checks guest/verified/admin user listing & accessing a Drafting Budget 2026f53
Increased both admin budget spec 63694b5 and budget model spec 1f0eb49 with drafting phase scenarios
Deployment
As usual
Warnings
We could have gone with CanCanCan to prevent non-admin's from accessing Budgets in drafting phase but... from my point of view that's a leak of information. Users could know there's an ongoing/drafting Budget by trying different url's until finding one that returns a "You cannot access this Budget" error instead of a 404 error. By imitating the same 404 behaviour as a non-existing budget url we are consistent in the behaviour, although I agree the disadvantage is that the "ability" is not represented in plain sight under
app/model/abilities/*
files :/