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
This commit is contained in:
parent
7fade0f1f1
commit
eef989cabf
1 changed files with 2 additions and 0 deletions
|
|
@ -14,7 +14,9 @@
|
|||
<li><a class="query-filter-button crayons-navigation__item" data-filter="class_name:Comment" href="javascript:;">
|
||||
<%= t("views.search.nav.comments") %>
|
||||
</a></li>
|
||||
<% if policy(Article).has_existing_articles_or_can_create_new_ones? %>
|
||||
<li><a class="query-filter-button my-posts-query-button crayons-navigation__item" data-filter="MY_POSTS" href="javascript:;">
|
||||
<%= t("views.search.nav.my_posts") %>
|
||||
</a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue