users: allow all users to use the posts per page setting.

This commit is contained in:
evazion
2020-03-21 23:04:12 -05:00
parent 88a8f459ed
commit f464163885
3 changed files with 1 additions and 16 deletions

View File

@@ -78,7 +78,6 @@ class User < ApplicationRecord
validates_presence_of :comment_threshold validates_presence_of :comment_threshold
validate :validate_sock_puppets, :on => :create, :if => -> { Danbooru.config.enable_sock_puppet_validation? } validate :validate_sock_puppets, :on => :create, :if => -> { Danbooru.config.enable_sock_puppet_validation? }
before_validation :normalize_blacklisted_tags before_validation :normalize_blacklisted_tags
before_validation :set_per_page
before_create :encrypt_password_on_create before_create :encrypt_password_on_create
before_update :encrypt_password_on_update before_update :encrypt_password_on_update
before_create :promote_to_admin_if_first_user before_create :promote_to_admin_if_first_user
@@ -349,12 +348,6 @@ class User < ApplicationRecord
def is_approver? def is_approver?
can_approve_posts? can_approve_posts?
end end
def set_per_page
if per_page.nil? || !is_gold?
self.per_page = Danbooru.config.posts_per_page
end
end
end end
module EmailMethods module EmailMethods

View File

@@ -91,12 +91,6 @@
<td>6 sec</td> <td>6 sec</td>
<td>9 sec</td> <td>9 sec</td>
</tr> </tr>
<tr>
<td>Variable Posts Per Page</td>
<td>No</td>
<td>Yes</td>
<td>Yes</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@@ -41,9 +41,7 @@
<%= f.input :theme, collection: User.themes.keys, include_blank: false, hint: "The site's colorscheme (light mode or dark mode)." %> <%= f.input :theme, collection: User.themes.keys, include_blank: false, hint: "The site's colorscheme (light mode or dark mode)." %>
<%= f.input :enable_safe_mode, label: "Safe mode", hint: "Show only safe images. Hide questionable and explicit images.", as: :select, include_blank: false, collection: [["Yes", "true"], ["No", "false"]] %> <%= f.input :enable_safe_mode, label: "Safe mode", hint: "Show only safe images. Hide questionable and explicit images.", as: :select, include_blank: false, collection: [["Yes", "true"], ["No", "false"]] %>
<% if CurrentUser.user.is_gold? %> <%= f.input :per_page, label: "Posts per page", as: :select, hint: "Number of thumbnails per page", collection: (1..PostSets::Post::MAX_PER_PAGE), include_blank: false %>
<%= f.input :per_page, :label => "Posts per page", :as => :select, :hint => "Number of thumbnails per page", :collection => (1..PostSets::Post::MAX_PER_PAGE), :include_blank => false %>
<% end %>
<%= f.input :default_image_size, hint: "Show full original images or resized #{Danbooru.config.large_image_width}px width samples.", label: "Default image width", collection: [["850px", "large"], ["original", "original"]], include_blank: false %> <%= f.input :default_image_size, hint: "Show full original images or resized #{Danbooru.config.large_image_width}px width samples.", label: "Default image width", collection: [["850px", "large"], ["original", "original"]], include_blank: false %>
<%= f.input :receive_email_notifications, as: :select, include_blank: false, collection: [["Yes", "true"], ["No", "false"]], hint: "Receive an email when you receive a new dmail." %> <%= f.input :receive_email_notifications, as: :select, include_blank: false, collection: [["Yes", "true"], ["No", "false"]], hint: "Receive an email when you receive a new dmail." %>
<%= f.input :time_zone, include_blank: false, hint: "The timezone to use for timestamps." %> <%= f.input :time_zone, include_blank: false, hint: "The timezone to use for timestamps." %>