From 019d94f1cbf915aa20296a2b803054f2a16e5086 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Tue, 4 Feb 2020 10:07:08 +1300 Subject: [PATCH 1/2] Show the default photo for social media --- app/helpers/photos_helper.rb | 4 ++++ app/views/gardens/show.html.haml | 3 +-- app/views/harvests/show.html.haml | 3 +-- app/views/plantings/show.html.haml | 3 +-- app/views/posts/show.html.haml | 1 + app/views/seeds/show.html.haml | 3 +-- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/helpers/photos_helper.rb b/app/helpers/photos_helper.rb index 9ae42c282..c4aaae7a4 100644 --- a/app/helpers/photos_helper.rb +++ b/app/helpers/photos_helper.rb @@ -19,6 +19,10 @@ module PhotosHelper photo_or_placeholder(garden) end + def post_image_path(post) + photo_or_placeholder(post) + end + def planting_image_path(planting) photo_or_placeholder(planting) end diff --git a/app/views/gardens/show.html.haml b/app/views/gardens/show.html.haml index f4746ad7c..d21eca928 100644 --- a/app/views/gardens/show.html.haml +++ b/app/views/gardens/show.html.haml @@ -1,8 +1,7 @@ = content_for :title, "#{@garden.owner}'s #{@garden}" - content_for :opengraph do - - @garden.photos.each do |photo| - = tag("meta", property: "og:image", content: photo.fullsize_url) + = tag("meta", property: "og:image", content: garden_image_path(@garden)) - if @garden.description = tag("meta", property: "og:description", content: og_description(@garden.description)) = tag("meta", property: "og:title", content: "#{@garden.owner}'s #{@garden}") diff --git a/app/views/harvests/show.html.haml b/app/views/harvests/show.html.haml index b5f98b55e..1bf04892f 100644 --- a/app/views/harvests/show.html.haml +++ b/app/views/harvests/show.html.haml @@ -1,7 +1,6 @@ = content_for :title, "#{@harvest.crop} harvested by #{@harvest.owner}" - content_for :opengraph do - - @harvest.photos.each do |photo| - = tag("meta", property: "og:image", content: photo.fullsize_url) + = tag("meta", property: "og:image", content: harvest_image_path(@harvest)) = tag("meta", property: "og:image:user_generated", content: "true") = tag("meta", property: "og:title", content: "#{@harvest.crop} harvested by #{@harvest.owner}") = tag("meta", property: "og:type", content: "website") diff --git a/app/views/plantings/show.html.haml b/app/views/plantings/show.html.haml index f57e46afc..e7b67d915 100644 --- a/app/views/plantings/show.html.haml +++ b/app/views/plantings/show.html.haml @@ -1,7 +1,6 @@ = content_for :title, "#{@planting.crop} in #{@planting.location}" - content_for :opengraph do - - @planting.crop.photos.limit(3).each do |photo| - = tag("meta", property: "og:image", content: photo.fullsize_url) + = tag("meta", property: "og:image", content: planting_image_path(@planting)) = tag("meta", property: "og:title", content: "#{@planting.crop} in #{@planting.location}") - if @planting.description = tag("meta", property: "og:description", content: og_description(@planting.description)) diff --git a/app/views/posts/show.html.haml b/app/views/posts/show.html.haml index efa29e670..99d6c5743 100644 --- a/app/views/posts/show.html.haml +++ b/app/views/posts/show.html.haml @@ -1,5 +1,6 @@ = content_for :title, @post.subject - content_for :opengraph do + = tag("meta", property: "og:image", content: post_image_path(@post)) = tag("meta", property: "og:image", content: avatar_uri(@post.author, 200)) = tag("meta", property: "og:description", content: og_description(@post.body)) = tag("meta", property: "og:title", content: @post.subject) diff --git a/app/views/seeds/show.html.haml b/app/views/seeds/show.html.haml index 6ce24f7e4..615afc58b 100644 --- a/app/views/seeds/show.html.haml +++ b/app/views/seeds/show.html.haml @@ -1,7 +1,6 @@ - content_for :title, "#{@seed.owner}'s #{@seed.crop} seeds" - content_for :opengraph do - - @seed.crop.photos.each do |photo| - = tag("meta", property: "og:image", content: photo.fullsize_url) + = tag("meta", property: "og:image", content: seed_image_path(@seed)) - if @seed.description = tag("meta", property: "og:description", content: og_description(@seed.description)) = tag("meta", property: "og:image", content: "#{@seed.owner}'s #{@seed.crop} seeds") From 697631dcce6a3e874819f00fedbfbfb01f26626f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2020 07:50:58 +0000 Subject: [PATCH 2/2] Bump unicorn from 5.5.2 to 5.5.3 Bumps [unicorn](https://yhbt.net/unicorn/) from 5.5.2 to 5.5.3. Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index b4be29c7d..760b58f7e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -533,7 +533,7 @@ GEM uglifier (4.2.0) execjs (>= 0.3.0, < 3) unicode-display_width (1.6.1) - unicorn (5.5.2) + unicorn (5.5.3) kgio (~> 2.6) raindrops (~> 0.7) uniform_notifier (1.13.0)