mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
31 lines
1.6 KiB
Plaintext
31 lines
1.6 KiB
Plaintext
<% post, content = post_and_content if local_assigns.key?(:post_and_content) %>
|
|
|
|
<%
|
|
blocked_post = user_signed_in? && post.user.present? && post.user.blocked_by?(current_user)
|
|
%>
|
|
|
|
<%
|
|
# Mute the post if it's one line that starts with ( and ends with )
|
|
muted_post = post.present? && post.to_model.content.split("\n").reject(&:empty?).all? { |paragraph| paragraph.strip.start_with?('(') && paragraph.strip.end_with?(')') }
|
|
muted_post_classes = 'muted-thredded-post'
|
|
%>
|
|
|
|
<% if blocked_post %>
|
|
<div class='grey-text text-lighten-2'>
|
|
<em class="tooltipped" data-tooltip="This message is hidden because you've blocked the user it's from.">1 message hidden.</em>
|
|
</div>
|
|
<% else %>
|
|
<%= render 'thredded/posts_common/before_first_unread_post', post: post if post.first_unread_in_page? %>
|
|
<%= content_tag :article, id: dom_id(post), class: "thredded--post thredded--#{post.read_state}--post #{muted_post ? muted_post_classes : 'card'}" do %>
|
|
<%= render 'thredded/posts_common/actions', post: post, actions: local_assigns[:actions] %>
|
|
<%= render 'thredded/posts_common/header', post: post %>
|
|
<%= ForumReplacementService.replace(content) || render('thredded/posts/content', post: post) %>
|
|
<% if post.pending_moderation? && !Thredded.content_visible_while_pending_moderation %>
|
|
<p class="thredded--alert thredded--alert-warning"><%= t 'thredded.posts.pending_moderation_notice' %></p>
|
|
<% elsif post.blocked? && post.can_moderate? %>
|
|
<p class="thredded--alert thredded--alert-danger">
|
|
<%= render 'thredded/shared/content_moderation_blocked_state', moderation_record: post.last_moderation_record %>
|
|
</p>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %> |