Open
Conversation
fny
requested changes
Jan 13, 2021
Owner
fny
left a comment
There was a problem hiding this comment.
Added some changes. I'll look at the front end shortly.
|
|
||
| ensure_or_forbidden! { current_user.admin_at?(location) } | ||
|
|
||
| location_account.destroy |
Owner
There was a problem hiding this comment.
Use destroy! so that this doesn't silently fail
| is_mobile_taken = User.mobile_taken?(request_json[:mobile_number]) | ||
| is_email_taken = User.email_taken?(request_json[:email]) | ||
|
|
||
| puts request_json[:mobile_number] |
| user = User.find(params[:user_id]) | ||
|
|
||
| ensure_or_forbidden! { current_user.admin_at? location } | ||
| ensure_or_forbidden! { user.location_accounts.exists?(location_id: location.id) } |
Owner
There was a problem hiding this comment.
- You shouldn't use a forbidden for this. This should be a not found error.
- You don't need this given the check above
|
|
||
| patch '/v1/locations/:location_id/users/:user_id' do | ||
| location = Location.find_by_id_or_permalink!(params[:location_id]) | ||
| user = User.find(params[:user_id]) |
Owner
There was a problem hiding this comment.
location.users.find(params[:user_id])
| puts is_mobile_taken | ||
| puts is_email_taken | ||
|
|
||
| if is_mobile_taken || is_email_taken |
Owner
There was a problem hiding this comment.
Instead of this check, create the user with the location account embedded. You should add a checkbox in the view to allow people to decide whether to send an invite.
user = User.new(...., location_accounts: LocationAccount.new(...))
if user.save
....
else
error_response(user)
end
|
|
||
| delete '/v1/locations/:location_id/users/:user_id' do | ||
| location = Location.find_by_id_or_permalink!(params[:location_id]) | ||
| user = User.find(params[:user_id]) |
Owner
There was a problem hiding this comment.
same thing as before location.users.find(...)
| locationAccount?: LocationAccount | null | ||
| } | ||
|
|
||
| export default function AdminUserEditPage(props: F7Props) { |
Owner
There was a problem hiding this comment.
Add return types to exports: here it's JSX.Element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.