Conversation
Current Code Coverage Percent of this PR:87.7 %Files having coverage below 100%
|
added 2 commits
June 7, 2022 09:56
|
|
||
| class ProfilePolicy < ApplicationPolicy | ||
| def remove_avatar? | ||
| true |
app/policies/profile_policy.rb
Outdated
| end | ||
|
|
||
| def update? | ||
| true |
app/policies/profile_policy.rb
Outdated
|
|
||
| def update? | ||
| true | ||
| end |
config/routes/internal_api.rb
Outdated
Comment on lines
40
to
41
| delete "profile/remove_avatar", to: "profile#remove_avatar" | ||
| put "profile", to: "profile#update" |
Member
There was a problem hiding this comment.
can we use a resourceful route
| def index | ||
| authorize :index, policy_class: ProfilePolicy | ||
| render json: { user: current_user } | ||
| if current_user.avatar.attached? |
Member
There was a problem hiding this comment.
this will return 500 error if the avatar is not attaches. because avatar_url is not defined in that case
Collaborator
Author
There was a problem hiding this comment.
nah it returns null
| else | ||
| render json: { error: "something went wrong" }, status: :unprocessable_entity | ||
| end | ||
| rescue Exception => e |
Member
There was a problem hiding this comment.
align the rescue with def
added 2 commits
June 8, 2022 12:35
Collaborator
Author
|
@akhilgkrishnan Can you please re-review it? |
config/routes/internal_api.rb
Outdated
Comment on lines
40
to
43
| resource :profile, only: [:update], controller: "profile" do | ||
| delete "/remove_avatar", to: "profile#remove_avatar" | ||
| get "/", to: "profile#index" | ||
| end |
Member
There was a problem hiding this comment.
Suggested change
| resource :profile, only: [:update], controller: "profile" do | |
| delete "/remove_avatar", to: "profile#remove_avatar" | |
| get "/", to: "profile#index" | |
| end | |
| resource :profile, only: [:update, :show], controller: "profile" do | |
| delete "/remove_avatar", to: "profile#remove_avatar" | |
| end |
Use show action instead of index in singular route
Collaborator
Author
There was a problem hiding this comment.
@akhilgkrishnan Then should I also change the action from "index" to "show" in the profile controller?
vipulnsward
pushed a commit
that referenced
this pull request
Feb 15, 2026
* add api for profile update * add index action * send avatar in index action * add request specs * fix review comments * use show action instead of index * update spec notice Co-authored-by: “Apoorv <“[email protected]”> Co-authored-by: Akhil G Krishnan <[email protected]>
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.
Notion card
https://www.notion.so/saeloun/6afc9500b2cc42af86be55f37894fb09?v=185bd45b9dc24dfcad9c57c07d32a7c0&p=1e983c2b00964a228c9ceabc2157b6d8
Summary
Preview
Added profile settings API to update first_name, last_name, password, and remove avatar of the user.
Please delete options that are not relevant.
not work as expected)
How Has This Been Tested?
Checklist: