From eef989cabf01b317bf00cbf1bb0787b49a66bfb1 Mon Sep 17 00:00:00 2001 From: Jeremy Friesen Date: Tue, 5 Apr 2022 16:18:09 -0400 Subject: [PATCH] Conditionally rendering "Search > My Posts" by policy (#17113) When a user does not have any posts NOR can they create posts, we are to hide the "Search > My Posts" section. I have chosen not to write a test for this as it's exercising a well tested policy and we don't have a unit test for this view. As part of forem/forem#17076 I introduced some cypress tests. But that feels like quite a bit of overkill for this feature. Closes forem/forem#16837 Related to forem/forem#16821 --- app/views/stories/articles_search/_nav_menu.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/stories/articles_search/_nav_menu.html.erb b/app/views/stories/articles_search/_nav_menu.html.erb index cc676c179..12ba11b50 100644 --- a/app/views/stories/articles_search/_nav_menu.html.erb +++ b/app/views/stories/articles_search/_nav_menu.html.erb @@ -14,7 +14,9 @@
  • <%= t("views.search.nav.comments") %>
  • + <% if policy(Article).has_existing_articles_or_can_create_new_ones? %>
  • <%= t("views.search.nav.my_posts") %>
  • + <% end %>