comments: set default comment threshold to -8.

* Set the default comment threshold to -8. This means that comments are
  hidden at -8 or lower and greyed out at -4 or lower.

* Reset the comment threshold to -8 for anyone with a threshold greater
  than -8. For reference, only about ~3100 users had a non-default
  threshold. About 1600 of those had their threshold reset to -8.

* Change the comment threshold to a less-than-or-equal comparison
  instead of a less-than comparsion. This means that a threshold of 0
  before is the same as a threshold of -1 now. Since everyone's
  thresholds were reset, this only affects people whose thresholds were
  already less than -8, which is so low that the difference shouldn't
  matter much.

* Set the maximum comment threshold to 5. For reference, less than 1% of
  comments have a score greater than 5.

* Set the minimum comment threshold to -100. For reference, the most
  downvoted comment has a score of -60.
This commit is contained in:
evazion
2021-01-19 05:15:02 -06:00
parent e1e3604f46
commit 9af407c94b
5 changed files with 31 additions and 5 deletions

View File

@@ -18,6 +18,19 @@
* You can now see when a post has deleted comments. Deleted comments are now
replaced with the word `[deleted]`, instead of being completely hidden.
* The way downvoted comments work has changed. Instead of comments being
completely hidden when they get downvoted, and having to click "Show X hidden
comments" to see them, now they get collapsed and marked as `[hidden]`, and
you click the comment itself to unhide it.
* The default comment threshold has been lowered to -8. This means that
comments are now hidden at -8 and greyed out at -4. If your threshold was
higher than this, it has been reset to -8. You can go to your settings to
change this.
* The maximum comment threshold is now 5 and the minumum threshold is now
-100. You can't set your threshold any higher or lower than this.
### API Changes
* Deleted comments now have some of their fields hidden in the API. The

View File

@@ -12,11 +12,11 @@ class CommentComponent < ApplicationComponent
end
def dimmed?
comment.is_deleted? || (!comment.is_sticky? && comment.score < current_user.comment_threshold/2.0)
comment.is_deleted? || (!comment.is_sticky? && comment.score <= current_user.comment_threshold/2.0)
end
def thresholded?
!comment.is_deleted? && !comment.is_sticky? && comment.score < current_user.comment_threshold
!comment.is_deleted? && !comment.is_sticky? && comment.score <= current_user.comment_threshold
end
def redact_deleted?

View File

@@ -81,7 +81,7 @@ class User < ApplicationRecord
attribute :last_logged_in_at, default: -> { Time.zone.now }
attribute :last_forum_read_at, default: "1960-01-01 00:00:00"
attribute :last_ip_addr
attribute :comment_threshold, default: 0
attribute :comment_threshold, default: -8
attribute :default_image_size, default: "large"
attribute :favorite_tags
attribute :blacklisted_tags, default: DEFAULT_BLACKLIST
@@ -108,7 +108,7 @@ class User < ApplicationRecord
validates_inclusion_of :default_image_size, :in => %w(large original)
validates_inclusion_of :per_page, in: (1..PostSets::Post::MAX_PER_PAGE)
validates_confirmation_of :password
validates_presence_of :comment_threshold
validates :comment_threshold, inclusion: { in: (-100..5) }
before_validation :normalize_blacklisted_tags
before_create :promote_to_admin_if_first_user
has_many :artist_versions, foreign_key: :updater_id

View File

@@ -45,7 +45,7 @@
<%= 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 :time_zone, include_blank: false, hint: "The timezone to use for timestamps." %>
<%= f.input :comment_threshold, hint: "Comments below this score will be hidden by default" %>
<%= f.input :comment_threshold, hint: "Comments at or below this score will be hidden by default.", input_html: { min: -100, max: 5 } %>
<%= f.input :blacklisted_tags, hint: "Posts with these tags will be hidden. Put each tag on a separate line. <a href='/wiki_pages/help:blacklists'>View help.</a>".html_safe, :input_html => {:size => "40x5", :data => {:autocomplete => "tag-query"}} %>
</fieldset>

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env ruby
require_relative "../../config/environment"
User.transaction do
users = User.where("comment_threshold > ?", User.anonymous.comment_threshold)
p users.count
users.update_all(comment_threshold: User.anonymous.comment_threshold)
users = User.where("comment_threshold < ?", -100)
p users.count
users.update_all(comment_threshold: -100)
end