|
1 | 1 | <% pingable = get_pingable(@comment_thread) %> |
2 | 2 |
|
| 3 | +<% if @post.present? %> |
3 | 4 | <% if @post.parent.present? %> |
4 | 5 | <details> |
5 | 6 | <summary>Parent</summary> |
|
15 | 16 | <h1>Comments on |
16 | 17 | <a href="<%= generic_share_link(@post) %>"><%= @post.title.blank? && @post.parent.present? ? @post.parent.title : @post.title %></a> |
17 | 18 | </h1> |
| 19 | +<% else %> |
| 20 | +<h1>Private Notification</h1> |
| 21 | +<% end %> |
18 | 22 |
|
19 | 23 | <!-- THREAD STARTS BELOW --> |
20 | 24 | <div class="<%= @comment_thread.deleted ? 'h-bg-red-050' : '' %> <%= params[:inline] == 'true' ? 'post--comments-thread is-embedded' : '' %>"> |
|
115 | 119 | <% unless current_user.nil? || params[:inline] == 'true' %> |
116 | 120 | <div class="widget--footer"> |
117 | 121 | <% if !@comment_thread.read_only? %> |
118 | | - <% if @post.locked? && !moderator? && !admin? %> |
| 122 | + <% if @post.present? && @post.locked? && !moderator? && !admin? %> |
119 | 123 | <p class="has-color-tertiary-500">Comments are disabled on locked posts.</p> |
120 | | - <% elsif @post.deleted %> |
| 124 | + <% elsif @post.present? && @post.deleted %> |
121 | 125 | <p class="has-color-tertiary-500">Comments are disabled on deleted posts.</p> |
122 | | - <% elsif @post.comments_disabled && !moderator? && !admin? %> |
| 126 | + <% elsif @post.present? && @post.comments_disabled && !moderator? && !admin? %> |
123 | 127 | <p class="has-color-red-500"><i class="fa fa-lock"></i> Comments have been disabled on the parent post.</p> |
124 | 128 | <% else %> |
125 | | - <% if @post.locked? %> |
| 129 | + <% if @post.present? && @post.locked? %> |
126 | 130 | <p class="has-color-red-500"><i class="fa fa-lock"></i> Comments are disabled on locked posts, but as a moderator you are exempt from that block.</p> |
127 | | - <% elsif @post.comments_disabled %> |
| 131 | + <% elsif @post.present? && @post.comments_disabled %> |
128 | 132 | <p class="has-color-red-500"><i class="fa fa-lock"></i> Comments have been disabled on this post, but as a moderator you are exempt from that block.</p> |
129 | 133 | <% end %> |
130 | 134 | <h4>Reply to this thread</h4> |
131 | 135 | <%= form_tag create_comment_path(@comment_thread.id) do %> |
132 | | - <%= hidden_field_tag :post_id, @post.id %> |
| 136 | + <%= hidden_field_tag :post_id, @post&.id %> |
133 | 137 |
|
134 | 138 | <%= label_tag :content, 'Your message', class: 'form-element' %> |
135 | 139 | <%= text_area_tag :content, '', class: 'form-element js-comment-field', |
136 | | - data: { thread: @comment_thread.id, post: @comment_thread.post_id, |
137 | | - character_count: ".js-character-count-#{@post.id}" } %> |
138 | | - <span class="has-float-right has-font-size-caption js-character-count-<%= @post.id %>" |
| 140 | + data: { thread: @comment_thread.id, post: @post&.id, |
| 141 | + character_count: ".js-character-count-#{@post&.id}" } %> |
| 142 | + <span class="has-float-right has-font-size-caption js-character-count-<%= @post&.id %>" |
139 | 143 | data-max="1000" data-min="15"> |
140 | 144 | <i class="fas fa-ellipsis-h js-character-count__icon"></i> |
141 | 145 | <span class="js-character-count__count">0 / 1000</span> |
|
0 commit comments