From 40e006f7cb20e588f9662327b2de802cf408d9e1 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 4 Aug 2017 19:28:36 -0500 Subject: [PATCH] Fix keyboard navigation in pools (#3238). Don't display the search navigation bar when browsing pools. Doing so breaks the A/D keyboard shortcuts because the search navigator takes precedence over the pool navigator. https://danbooru.donmai.us/forum_topics/9127?page=195#forum_post_134297 --- app/presenters/post_presenter.rb | 8 +++++--- app/views/posts/partials/show/_nav_links.html.erb | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index 75178f43e..fbe33a8ff 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -196,11 +196,13 @@ class PostPresenter < Presenter end def has_nav_links?(template) - has_sequential_navigation?(template) || @post.pools.undeleted.any? || @post.favorite_groups(active_id=template.params[:favgroup_id]).any? + has_sequential_navigation?(template.params) || @post.pools.undeleted.any? || @post.favorite_groups(active_id=template.params[:favgroup_id]).any? end - def has_sequential_navigation?(template) - CurrentUser.user.enable_sequential_post_navigation && template.params[:tags] !~ /(?:^|\s)(?:order|ordfav|ordpool):/i + def has_sequential_navigation?(params) + return false if params[:tags] =~ /(?:^|\s)(?:order|ordfav|ordpool):/i + return false if params[:pool_id].present? || params[:favgroup_id].present? + return CurrentUser.user.enable_sequential_post_navigation end def post_footer_for_pool_html(template) diff --git a/app/views/posts/partials/show/_nav_links.html.erb b/app/views/posts/partials/show/_nav_links.html.erb index 21858d94d..b5ef547f5 100644 --- a/app/views/posts/partials/show/_nav_links.html.erb +++ b/app/views/posts/partials/show/_nav_links.html.erb @@ -1,6 +1,6 @@ <% if (position == "bottom" && CurrentUser.user.new_post_navigation_layout) || (position == "top" && !CurrentUser.user.new_post_navigation_layout) %>