diff --git a/app/logical/danbooru/has_bit_flags.rb b/app/logical/danbooru/has_bit_flags.rb index dc3536dc3..10074948f 100644 --- a/app/logical/danbooru/has_bit_flags.rb +++ b/app/logical/danbooru/has_bit_flags.rb @@ -10,15 +10,15 @@ module Danbooru def has_bit_flags(attributes, options = {}) field = options[:field] || :bit_flags + define_singleton_method("flag_value_for") do |key| + index = attributes.index(key) + raise IndexError if index.nil? + 1 << index + end + attributes.each.with_index do |attribute, i| bit_flag = 1 << i - define_singleton_method("flag_value_for") do |key| - index = attributes.index(key) - raise IndexError if index.nil? - 1 << index - end - define_method(attribute) do send(field) & bit_flag > 0 end diff --git a/app/logical/storage_manager.rb b/app/logical/storage_manager.rb index a03f7601b..00a5e4a6d 100644 --- a/app/logical/storage_manager.rb +++ b/app/logical/storage_manager.rb @@ -97,7 +97,6 @@ class StorageManager def protected_params(url, post, secret: Danbooru.config.protected_file_secret) user_id = CurrentUser.id - ip = CurrentUser.ip_addr time = (Time.now + 15.minute).to_i secret = secret hmac = Digest::MD5.base64digest("#{time} #{url} #{user_id} #{secret}").tr("+/","-_").gsub("==",'') diff --git a/app/models/forum_post.rb b/app/models/forum_post.rb index 1372e9a29..06082f9f7 100644 --- a/app/models/forum_post.rb +++ b/app/models/forum_post.rb @@ -196,14 +196,6 @@ class ForumPost < ApplicationRecord self.is_hidden = false if is_hidden.nil? end - def creator_name - User.id_to_name(creator_id) - end - - def updater_name - User.id_to_name(updater_id) - end - def forum_topic_page (ForumPost.where("topic_id = ? and created_at <= ?", topic_id, created_at).count / Danbooru.config.records_per_page.to_f).ceil end diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 9a22b0212..6db37b891 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -3,7 +3,7 @@
<%= render "layouts/head" %> -<%= tag.body **body_attributes(CurrentUser.user) do %> +<%= tag.body(**body_attributes(CurrentUser.user)) do %> <%= render "layouts/theme_include" %>