From 99d447279b8717213de5521298c492d6b6744f35 Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 14 Jan 2021 16:37:29 -0600 Subject: [PATCH] users: remove option to disable keyboard shortcuts. Remove the enable_post_navigation option. This option was originally added to disable the next/prev post navbar beneath posts. It was later repurposed to disable keyboard shortcuts. Users who don't want keyboard shortcuts are advised to not press random buttons on the keyboard like a caveman. Only ~1200 users disabled this option and only ~600 were seen in the last year. --- CHANGELOG.md | 2 ++ app/helpers/application_helper.rb | 4 ++-- app/javascript/src/javascripts/utility.js | 5 +---- app/models/user.rb | 1 - app/policies/user_policy.rb | 12 ++++++------ app/views/users/edit.html.erb | 1 - 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33c9d3355..b9133108b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ * Removed the option to disable the next/previous post navbar. +* Removed the option to disable keyboard shortcuts. + ## 2021-01-12 ### Changes diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f0c161641..4dfd9e9cf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -290,8 +290,8 @@ module ApplicationHelper id name level level_string theme always_resize_images can_upload_free can_approve_posts disable_categorized_saved_searches disable_mobile_gestures disable_post_tooltips enable_auto_complete - enable_post_navigation enable_safe_mode hide_deleted_posts - show_deleted_children style_usernames default_image_size + enable_safe_mode hide_deleted_posts show_deleted_children style_usernames + default_image_size ] + User::Roles.map { |role| :"is_#{role}?" } end diff --git a/app/javascript/src/javascripts/utility.js b/app/javascript/src/javascripts/utility.js index 699278d7b..03e831858 100644 --- a/app/javascript/src/javascripts/utility.js +++ b/app/javascript/src/javascripts/utility.js @@ -1,4 +1,3 @@ -import CurrentUser from "./current_user"; import Rails from '@rails/ujs'; let Utility = {}; @@ -74,9 +73,7 @@ Utility.dialog = function(title, html) { } Utility.keydown = function(keys, namespace, handler, selector = document) { - if (CurrentUser.data("enable-post-navigation")) { - $(selector).on("keydown.danbooru." + namespace, null, keys, handler); - } + $(selector).on("keydown.danbooru." + namespace, null, keys, handler); }; Utility.is_subset = function(array, subarray) { diff --git a/app/models/user.rb b/app/models/user.rb index 152f55558..d0c9f7109 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -669,7 +669,6 @@ class User < ApplicationRecord extend SearchMethods def initialize_attributes - self.enable_post_navigation = true self.new_post_navigation_layout = true self.enable_auto_complete = true self.always_resize_images = true diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index e21352bce..28b02f1aa 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -44,12 +44,12 @@ class UserPolicy < ApplicationPolicy :comment_threshold, :default_image_size, :favorite_tags, :blacklisted_tags, :time_zone, :per_page, :custom_style, :theme, :receive_email_notifications, :always_resize_images, - :enable_post_navigation, :new_post_navigation_layout, - :enable_private_favorites, :hide_deleted_posts, :style_usernames, - :enable_auto_complete, :show_deleted_children, - :disable_categorized_saved_searches, :disable_tagged_filenames, - :disable_cropped_thumbnails, :disable_mobile_gestures, :enable_safe_mode, - :enable_desktop_mode, :disable_post_tooltips, + :new_post_navigation_layout, :enable_private_favorites, + :hide_deleted_posts, :style_usernames, :enable_auto_complete, + :show_deleted_children, :disable_categorized_saved_searches, + :disable_tagged_filenames, :disable_cropped_thumbnails, + :disable_mobile_gestures, :enable_safe_mode, :enable_desktop_mode, + :disable_post_tooltips, ].compact end diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 572d9985d..a249a7942 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -59,7 +59,6 @@ <%= f.input :style_usernames, :as => :select, :label => "Colored usernames", :hint => "Color users according to their user level", :include_blank => false, :collection => [["Yes", "true"], ["No", "false"]] %> - <%= f.input :enable_post_navigation, :as => :select, :include_blank => false, :label => "Enable keyboard shortcuts", :hint => "Enable keyboard shortcuts", :collection => [["Yes", "true"], ["No", "false"]] %> <%= f.input :new_post_navigation_layout, :as => :select, :label => "Navigation bar position", :include_blank => false, :collection => [["Below", "true"], ["Above", "false"]], :hint => "When browsing pools or posts, place navigation links above or below the image" %> <%= f.input :hide_deleted_posts, :as => :select, :label => "Deleted post filter", :hint => "Remove deleted posts from search results", :include_blank => false, :collection => [["Yes", "true"], ["No", "false"]] %> <%= f.input :show_deleted_children, :as => :select, :label => "Show deleted children", :hint => "Show thumbnail borders on parent posts even if the children are deleted", :include_blank => false, :collection => [["Yes", "true"], ["No", "false"]] %>