user profiles: fix links when Post.fast_count returns nil.
If Post.fast_count returns nil, then the link_to call becomes link_to(nil, <posts_path>) so the link text becomes the url itself, which isn't what we want. Instead the count is displayed as a '?' mark to indicate that we don't know the true count.
This commit is contained in:
@@ -97,6 +97,7 @@ class UserPresenter
|
||||
|
||||
def commented_posts_count(template)
|
||||
count = CurrentUser.without_safe_mode { Post.fast_count("commenter:#{user.name}") }
|
||||
count = "?" if count.nil?
|
||||
template.link_to(count, template.posts_path(:tags => "commenter:#{user.name} order:comment_bumped"))
|
||||
end
|
||||
|
||||
@@ -110,6 +111,7 @@ class UserPresenter
|
||||
|
||||
def noted_posts_count(template)
|
||||
count = CurrentUser.without_safe_mode { Post.fast_count("noteupdater:#{user.name}") }
|
||||
count = "?" if count.nil?
|
||||
template.link_to(count, template.posts_path(:tags => "noteupdater:#{user.name} order:note"))
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user