This commit is contained in:
r888888888
2017-10-30 14:47:00 -07:00
parent aff81bb9ed
commit 32ff7de6d8
5 changed files with 23 additions and 3 deletions

View File

@@ -38,6 +38,9 @@
}
Danbooru.Post.initialize_gestures = function() {
if (Danbooru.meta("disable-mobile-gestures") === "true") {
return;
}
var $body = $("body");
if ($body.data("hammer")) {
return;

View File

@@ -261,6 +261,10 @@ class AnonymousUser
false
end
def disable_mobile_gestures?
false
end
User::Roles.reject {|r| r == :anonymous}.each do |name|
define_method("is_#{name}?") do
false

View File

@@ -25,6 +25,15 @@ class User < ApplicationRecord
:verified,
]
# candidates for removal:
# - enable_post_navigation (disabled by 700)
# - new_post_navigation_layout (disabled by 1364)
# - enable_sequential_post_navigation (disabled by 680)
# - hide_deleted_posts (enabled by 1904)
# - disable_categorized_saved_searches (enabled by 2291)
# - disable_tagged_filenames (enabled by 387)
# - enable_recent_searches (enabled by 499)
# - disable_cropped_thumbnails (enabled by 22)
BOOLEAN_ATTRIBUTES = %w(
is_banned
has_mail
@@ -46,13 +55,14 @@ class User < ApplicationRecord
disable_tagged_filenames
enable_recent_searches
disable_cropped_thumbnails
disable_mobile_gestures
)
include Danbooru::HasBitFlags
has_bit_flags BOOLEAN_ATTRIBUTES, :field => "bit_prefs"
attr_accessor :password, :old_password
attr_accessible :dmail_filter_attributes, :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :password, :old_password, :password_confirmation, :password_hash, :email, :last_logged_in_at, :last_forum_read_at, :has_mail, :receive_email_notifications, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :name, :ip_addr, :time_zone, :default_image_size, :enable_sequential_post_navigation, :per_page, :hide_deleted_posts, :style_usernames, :enable_auto_complete, :custom_style, :show_deleted_children, :disable_categorized_saved_searches, :disable_tagged_filenames, :enable_recent_searches, :disable_cropped_thumbnails, :as => [:moderator, :gold, :platinum, :member, :anonymous, :default, :builder, :admin]
attr_accessible :dmail_filter_attributes, :enable_privacy_mode, :enable_post_navigation, :new_post_navigation_layout, :password, :old_password, :password_confirmation, :password_hash, :email, :last_logged_in_at, :last_forum_read_at, :has_mail, :receive_email_notifications, :comment_threshold, :always_resize_images, :favorite_tags, :blacklisted_tags, :name, :ip_addr, :time_zone, :default_image_size, :enable_sequential_post_navigation, :per_page, :hide_deleted_posts, :style_usernames, :enable_auto_complete, :custom_style, :show_deleted_children, :disable_categorized_saved_searches, :disable_tagged_filenames, :enable_recent_searches, :disable_cropped_thumbnails, :disable_mobile_gestures, :as => [:moderator, :gold, :platinum, :member, :anonymous, :default, :builder, :admin]
attr_accessible :level, :as => :admin
validates :name, user_name: true, on: :create

View File

@@ -26,6 +26,7 @@
<meta name="mobile-mode" content="<%= CurrentUser.mobile_mode? %>">
<meta name="last-forum-read-at" content="<%= CurrentUser.user.last_forum_read_at %>">
<meta name="disable-labeled-saved-searches" content="<%= CurrentUser.disable_categorized_saved_searches? %>">
<%= content_tag(:meta, nil, name: "disable-mobile-gestures", content: CurrentUser.disable_mobile_gestures?) %>
<%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %>
<%= stylesheet_link_tag "application", :media => "screen" %>
<% if CurrentUser.user.custom_style.present? %>

View File

@@ -4,8 +4,8 @@
<%= simple_form_for @user do |f| %>
<h2 id="edit-options">
<%= link_to "Basic settings", "#basic-settings", :class => "active" %>
| <%= link_to "Advanced settings", "#advanced-settings" %>
<%= link_to "Basic", "#basic-settings", :class => "active" %>
| <%= link_to "Advanced", "#advanced-settings" %>
<% if CurrentUser.user.id == @user.id %>
| <%= link_to "Change password", edit_user_password_path(:user_id => @user.id), :id => "change-password" %>
| <%= link_to "Delete account", maintenance_user_deletion_path, :id => "delete-account" %>
@@ -74,6 +74,8 @@
<%= f.input :disable_tagged_filenames, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
<%= f.input :disable_mobile_gestures, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
<%#= f.input :disable_cropped_thumbnails, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
<div class="input text optional field_with_hint">