Skip to content

Commit 315cb36

Browse files
authored
Merge pull request #2020 from codidact/0valt/2017/0-more-comments
2 parents 4a18457 + 898fa6b commit 315cb36

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

app/views/comment_threads/_expanded.html.erb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@
5959
<%= render 'comments/skip_deleted', inline: inline, num_skipped: skipped_deleted, thread: thread %>
6060
<% skipped_deleted = 0 %>
6161
<% end %>
62-
<% if shown_comments_count > max_shown_comments && comment.id.to_i == comment_id.to_i %>
63-
<%= render 'comments/skip_more', shown_count: shown_comments_count, thread: thread %>
62+
<% skipped_more = thread.reply_count - shown_comments_count %>
63+
<% if shown_comments_count > max_shown_comments && skipped_more.positive? && comment.id.to_i == comment_id.to_i %>
64+
<%= render 'comments/skip_more', num_skipped: skipped_more, thread: thread %>
6465
<% end %>
6566
<div class="widget--body" role="listitem">
6667
<%= render 'comments/comment', comment: comment, pingable: pingable %>

app/views/comments/_skip_more.html.erb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
Renders widgets indicating that there more comments are not shown
33
44
Variables:
5-
shown_count : number of comments shown on the thread
5+
num_skipped : number of comments skipped on the thread
66
thread : CommentThread to display the widget for
77
%>
88

99
<div class="widget--body widget--more-comments" role="listitem">
10-
<% skipped_count = thread.reply_count - shown_count %>
11-
<p>Skipping <%= pluralize(skipped_count, 'more comment') %></p>
10+
<p>Skipping <%= pluralize(num_skipped, 'more comment') %></p>
1211
</div>

0 commit comments

Comments
 (0)