create social preview for comment that is missing commentable (#5171) [deploy]
This commit is contained in:
parent
662a99ade3
commit
36aed0458e
2 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
<div class="title-area">
|
||||
<h2>re: <%= @comment.commentable.title %></h2>
|
||||
<h2>re: <%= @comment.commentable&.title %></h2>
|
||||
<h1 style="font-size:<%= font_size %>vw;"><%= @comment.title %></h1>
|
||||
</div>
|
||||
<div class="preview-user">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue