wiki pages: don't show create links to anonymous users on non-existent pages

This commit is contained in:
Lily
2022-11-12 09:21:20 -04:00
committed by GitHub
parent a167091bf9
commit 32fbc4e65f

View File

@@ -27,7 +27,11 @@
<% end %> <% end %>
<% if @wiki_page.new_record? %> <% if @wiki_page.new_record? %>
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(wiki_page: { title: @wiki_page.title }), rel: "nofollow" %>.</p> <p>This wiki page does not exist.
<% if policy(@wiki_page).create? %>
<%= link_to "Create new wiki page", new_wiki_page_path(wiki_page: { title: @wiki_page.title }), rel: "nofollow" %>.</p>
<% end %>
</p>
<% else %> <% else %>
<%= format_text(@wiki_page.body) %> <%= format_text(@wiki_page.body) %>
<% end %> <% end %>