blueimpact / kucipong

BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Handle null and undefined images. #138

Closed cdepillabout closed 7 years ago

cdepillabout commented 7 years ago

This PR allows images to be null or undefined.

Here is how the new logic works for uploading images:

If the defaultImage is null and the user has not uploaded an image, then the image will be removed from the store/coupon.

If the defaultImage is "" and the user has not uploaded an image, then the image will be removed from the store/coupon. (This might be caused by a bug on the image uploading functionality, but I decided to handle it anyway. We can always remove functionality out later.)

If the defaultImage is some image name, and the user has not uploaded an image, then the defaultImage URL will be used as the store/coupon image name.

If the user has uploaded a file called image, it will be uploaded to S3, and the filename on S3 will be used as the store/coupon image name.

Fixes #125 and fixes #137.

cdepillabout commented 7 years ago

This should also fix #55.

arowM commented 7 years ago

LGTM!