From 77935808e2efd6a997579100e8c0baad36bce99c Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 5 Jan 2020 17:43:02 -0600 Subject: [PATCH] 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, ) 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. --- app/presenters/user_presenter.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/presenters/user_presenter.rb b/app/presenters/user_presenter.rb index 963ddab0c..93f3e8dda 100644 --- a/app/presenters/user_presenter.rb +++ b/app/presenters/user_presenter.rb @@ -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