(This ticket can only be done after we have added the pictures feature)
If the user leaves the image link blank, include a cute default picture.
Look at index.js in the saveNewPost function.
Currently, the server copies information from the request (accessed through request.body) into a new post object.
Once it finishes, it saves the post.
Before it saves the post, we can make corrections to the post. Add something like this:
if (post.image === "") {
post.image = "http://example.com/a-nice-picture.jpg"
}
Replace the URL with a link to an actual picture.
Test that it works.
While we're here, do we want to add default values for anything else that the user might leave blank? For example, if they leave the author name blank, we could replace it with "A community member" or "anonymous".
[ ] add default values for any other fields you think should have a default value
(This ticket can only be done after we have added the pictures feature)
If the user leaves the image link blank, include a cute default picture.
Look at
index.js
in thesaveNewPost
function.Currently, the server copies information from the request (accessed through request.body) into a new post object.
Once it finishes, it saves the post.
Before it saves the post, we can make corrections to the post. Add something like this:
Replace the URL with a link to an actual picture.
Test that it works.
While we're here, do we want to add default values for anything else that the user might leave blank? For example, if they leave the author name blank, we could replace it with "A community member" or "anonymous".