diff --git a/CHANGELOG.md b/CHANGELOG.md index 61645573..7a29ca1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. * Add support for facebook authentication using omniauth * Fix issue with sending emails (#48) * Add Polish and Romanian translations +* Fix issue with updating logo ## 1.3.0 / 2017-12-04 diff --git a/app/controllers/pwb/api/v1/web_contents_controller.rb b/app/controllers/pwb/api/v1/web_contents_controller.rb index 30e70786..3ade542f 100644 --- a/app/controllers/pwb/api/v1/web_contents_controller.rb +++ b/app/controllers/pwb/api/v1/web_contents_controller.rb @@ -16,11 +16,16 @@ def update_photo # where photo has never been set before, associated Content will not exist content = Content.find_by_key(content_tag) || Content.create({ key: content_tag, tag: 'appearance' }) photo = ContentPhoto.create + if content_tag == "logo" + # TODO: This is a workaround + # need to have a way of determining content that should only have + # one photo and enforcing that + content.content_photos.destroy_all + end content.content_photos.push photo end # TODO: - handle where no photo or content_tag.. end - if params[:file] photo.image = params[:file] end