From 36aed0458e2efebb7393eee8774eb7bf643b4115 Mon Sep 17 00:00:00 2001 From: Molly Struve Date: Thu, 19 Dec 2019 10:14:37 -0600 Subject: [PATCH] create social preview for comment that is missing commentable (#5171) [deploy] --- app/controllers/social_previews_controller.rb | 2 +- app/views/social_previews/comment.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/social_previews_controller.rb b/app/controllers/social_previews_controller.rb index b7107f482..676290a6b 100644 --- a/app/controllers/social_previews_controller.rb +++ b/app/controllers/social_previews_controller.rb @@ -40,7 +40,7 @@ class SocialPreviewsController < ApplicationController def comment @comment = Comment.find(params[:id]) - @tag_badges = Badge.where(id: Tag.where(name: @comment.commentable.decorate.cached_tag_list_array).pluck(:badge_id)) + @tag_badges = Badge.where(id: Tag.where(name: @comment.commentable&.decorate&.cached_tag_list_array).pluck(:badge_id)) set_respond end diff --git a/app/views/social_previews/comment.html.erb b/app/views/social_previews/comment.html.erb index 9fbee3f54..0460983ba 100644 --- a/app/views/social_previews/comment.html.erb +++ b/app/views/social_previews/comment.html.erb @@ -113,10 +113,10 @@ <% elsif @comment.title.size < 50 %> <% font_size = 8.3 %> <% else %> - <% font_size = 15 - ((((@comment.title).size**0.92) + 85) / 16) %> + <% font_size = 15 - (((@comment.title.size**0.92) + 85) / 16) %> <% end %>
-

re: <%= @comment.commentable.title %>

+

re: <%= @comment.commentable&.title %>

<%= @comment.title %>