|
278 | 278 | Flag |
279 | 279 | </a> |
280 | 280 | <% end %> |
281 | | - <% unless post.locked? || !post_type.is_closeable %> |
282 | | - <% if check_your_privilege('flag_close') || (post.user_id === current_user&.id)%> |
283 | | - <% if !post.closed %> |
284 | | - <a href="#" class="close-dialog-link tools--item" role="button" aria-label="Close this post"> |
285 | | - <i class="fa fa-lock"></i> |
286 | | - Close |
287 | | - </a> |
288 | | - <% elsif post.closed %> |
289 | | - <%= link_to reopen_post_path(post), method: :post, class: 'reopen-question tools--item', role: 'button', 'aria-label': 'Reopen this post' do %> |
290 | | - <i class="fa fa-unlock"></i> |
291 | | - Reopen |
292 | | - <% end %> |
| 281 | + <% if current_user&.can_close?(post) %> |
| 282 | + <% if !post.closed %> |
| 283 | + <a href="#" |
| 284 | + class="close-dialog-link tools--item" |
| 285 | + role="button" |
| 286 | + aria-label="Close this post"> |
| 287 | + <i class="fa fa-lock"></i> |
| 288 | + Close |
| 289 | + </a> |
| 290 | + <% else %> |
| 291 | + <%= link_to reopen_post_path(post), method: :post, |
| 292 | + class: 'reopen-question tools--item', |
| 293 | + role: 'button', 'aria-label': 'Reopen this post' do %> |
| 294 | + <i class="fa fa-unlock"></i> |
| 295 | + Reopen |
293 | 296 | <% end %> |
294 | 297 | <% end %> |
295 | 298 | <% end %> |
|
347 | 350 |
|
348 | 351 | <%= render 'posts/flag_modal', post: post, user: current_user %> |
349 | 352 |
|
350 | | - <% if post_type.is_closeable %> |
351 | | - <div class="post--action-dialog js-close-box"> |
352 | | - <div class="widget"> |
353 | | - <div class="widget--header">Why should this post be closed?</div> |
354 | | - <% CloseReason.active.each do |reason| %> |
355 | | - <div class="widget--body"> |
356 | | - <div class="grid"> |
357 | | - <div class="grid--cell"> |
358 | | - <input class="form-radio-element" type="radio" name="close-reason" value="<%= reason.id %>" |
359 | | - id="close-reason-<%= reason.id %>" data-rop="<%= reason.requires_other_post %>"> |
360 | | - </div> |
361 | | - <div class="grid--cell is-flexible"> |
362 | | - <label class="form-element" for="close-reason-<%= reason.id %>"> |
363 | | - <%= reason.name %> |
364 | | - <div class="form-caption"> |
365 | | - <%= raw render_markdown(reason.description.gsub "$SiteName", SiteSetting['SiteName']) %> |
366 | | - </div> |
367 | | - </label> |
368 | | - <% if reason.requires_other_post %> |
369 | | - <input required class="form-element has-margin-top-8 js-close-other-post" |
370 | | - id="close-reason-other-post-<%= reason.id %>" |
371 | | - placeholder="Please enter the URL or ID of the other post in this community." |
372 | | - name="close-reason-other-post" /> |
373 | | - <% end %> |
374 | | - </div> |
375 | | - </div> |
376 | | - </div> |
377 | | - <% end %> |
378 | | - <div class="widget--footer"> |
379 | | - <button class="js-close-question button is-filled is-muted" data-post-id="<%= post.id %>"> |
380 | | - Close this post |
381 | | - </button> |
382 | | - </div> |
383 | | - </div> |
384 | | - </div> |
| 353 | + <% if current_user&.can_close?(post) %> |
| 354 | + <%= render 'posts/close_modal', post: post %> |
385 | 355 | <% end %> |
386 | 356 |
|
387 | 357 | <% if current_user&.privilege?('flag_curate') %> |
|
0 commit comments