-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Fix support for adding social image to the Pages API #20916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Uffizzi Ephemeral Environment Deploying☁️ https://app.uffizzi.com/github.com/forem/forem/pull/20916 ⚙️ Updating now by workflow run 8937638497. What is Uffizzi? Learn more! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -39,8 +39,11 @@ def require_admin | |||
end | |||
|
|||
def permitted_params | |||
if params[:social_image].present? && params[:social_image][:url].present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking nit: there's a nice dig
method for this.
if params[:social_image].present? && params[:social_image][:url].present? | |
if params.dig(:social_image, :url).present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I have some confusion on whether simply setting a param of remote_social_image_url
works vs having to call the method as a setter, but I think the tests seem to show this works.
And if there's still a small additional change to be made we can do as a follow-up.
What type of PR is this? (check all applicable)
Description
This fixes support for specifying the
social_image
for Pages via the API. The docs don't specify a format for the URL, I've used the same format as the GET route... social_image: { url: "https://blah.png" }
.Added/updated tests?
We encourage you to keep the code coverage percentage at 80% and above.