girlcodeakl / girlcode2018-term2

Girl Code project
0 stars 0 forks source link

Default picture if user doesn't include a picture #20

Closed mgatland closed 6 years ago

mgatland commented 6 years ago

(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".