From 3bffc67d5a05c42b2cac0bb49f0388c8c30b8005 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Wed, 9 Dec 2015 15:45:43 -0800 Subject: [PATCH] fixes #2558: site map links --- app/models/saved_search.rb | 4 ++++ app/views/saved_searches/index.html.erb | 2 +- app/views/static/site_map.html.erb | 11 +++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/models/saved_search.rb b/app/models/saved_search.rb index 681bcd5ad..8556a3f7e 100644 --- a/app/models/saved_search.rb +++ b/app/models/saved_search.rb @@ -3,6 +3,10 @@ class SavedSearch < ActiveRecord::Base extend ActiveSupport::Concern module ClassMethods + def posts_search_available? + Danbooru.config.listbooru_server.present? && CurrentUser.is_gold? + end + def refresh_listbooru(user_id) return unless Danbooru.config.listbooru_auth_key user = User.find(user_id) diff --git a/app/views/saved_searches/index.html.erb b/app/views/saved_searches/index.html.erb index db452e677..4066a02eb 100644 --- a/app/views/saved_searches/index.html.erb +++ b/app/views/saved_searches/index.html.erb @@ -5,7 +5,7 @@ <% @categories.each do |category, saved_searches| %>

<% if category.present? %> - <%= link_to category.tr("_", " "), posts_path(:tags => "search:#{category}") %> + <%= link_to_if SavedSearch.posts_search_available?, category.tr("_", " "), posts_path(:tags => "search:#{category}") %> <% else %> Uncategorized <% end %> diff --git a/app/views/static/site_map.html.erb b/app/views/static/site_map.html.erb index fa835f4b8..31204023e 100644 --- a/app/views/static/site_map.html.erb +++ b/app/views/static/site_map.html.erb @@ -14,7 +14,7 @@ <% if CurrentUser.can_approve_posts? %>
  • <%= link_to("Moderate", moderator_post_queue_path) %>
  • <% end %> - <% if CurrentUser.is_admin? %> + <% if CurrentUser.is_moderator? %>
  • <%= link_to("Mass Edit", edit_moderator_tag_path) %>
  • <% end %> @@ -89,7 +89,7 @@
    • Users

    • - <% if CurrentUser.can_approve_posts? %> + <% if CurrentUser.is_moderator? %>
    • <%= link_to("Dashboard", moderator_dashboard_path) %>
    • <% end %>
    • <%= link_to("Help", wiki_pages_path(:title => "help:users")) %>
    • @@ -109,10 +109,13 @@
    • <%= link_to("Mod Actions", mod_actions_path) %>
    • <%= link_to("Jobs", delayed_jobs_path) %>
    • <%= link_to("Bulk Update Requests", bulk_update_requests_path) %>
    • +
    • <%= link_to("Janitor Trials", janitor_trials_path) %>
    • + + <% if CurrentUser.is_moderator? %> +
    • <%= link_to("IP Bans", ip_bans_path) %>
    • + <% end %> <% if CurrentUser.is_admin? %> -
    • <%= link_to("Janitor Trials", janitor_trials_path) %>
    • -
    • <%= link_to("IP Bans", ip_bans_path) %>
    • <%= link_to("News Updates", news_updates_path) %>
    • <%= link_to("Alias & Implication Import", new_admin_alias_and_implication_import_path) %>
    • <%= link_to("Admin Dashboard", admin_dashboard_path) %>