Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/controllers/api/v4/comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ def create

require_oauth2_scope "comments:write", :create

def update
@comment = authorize Comment.find_by_public_id!(params[:id])

@comment.update!(params.permit(:content, :admin_only))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please write tests for this?

  • When admin_only is omitted, it doesn't change admin_only in the DB
    • make sure to the case where it start as admin_only = true
  • When admin_only is a non-boolean (e.g. string or integer), what do we do?


render "show"
end

require_oauth2_scope "comments:write", :update

end
end
end
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@
resources :wires, only: [:index, :show, :create]
resources :ach_transfers, only: [:create]

resources :comments, only: [:index, :create]
resources :comments, only: [:index, :create, :update]

get "stripe_terminal_connection_token", to: "stripe_terminal#connection_token"

Expand Down