diff --git a/app/models/moderation_vote.rb b/app/models/moderation_vote.rb deleted file mode 100644 index 14f70bf0..00000000 --- a/app/models/moderation_vote.rb +++ /dev/null @@ -1,6 +0,0 @@ -class ModerationVote < ApplicationRecord - belongs_to :user - belongs_to :report - validates :user_id, presence: true - validates :report_id, presence: true -end diff --git a/app/models/report.rb b/app/models/report.rb index b801d322..3d184f08 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -1,6 +1,5 @@ class Report < ApplicationRecord belongs_to :user - has_many :moderation_votes, dependent: :destroy has_many :moderation_comments, dependent: :destroy validates :type, presence: true validates :target_id, presence: true @@ -10,10 +9,6 @@ class Report < ApplicationRecord type.sub('Reports::', '').constantize.where(id: target_id).first end - def votes - moderation_votes.where(upvote: true).count - moderation_votes.where(upvote: false).count - end - class << self include CursorPaginatable diff --git a/app/models/user.rb b/app/models/user.rb index 3d90ebc9..e7e1f030 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -36,7 +36,6 @@ class User < ApplicationRecord has_many :notifications, foreign_key: :recipient_id, dependent: :destroy_async has_many :reports, dependent: :destroy_async has_many :moderation_comments, dependent: :destroy_async - has_many :moderation_votes, dependent: :destroy_async has_many :lists, dependent: :destroy_async has_many :list_memberships, class_name: "ListMember", dependent: :destroy_async has_many :mute_rules, dependent: :destroy_async @@ -156,30 +155,6 @@ class User < ApplicationRecord end end - # @param upvote [Boolean] - def report_vote(report, upvote = false) - return unless mod? - ModerationVote.create!(user: self, report: report, upvote: upvote) - end - - def report_unvote(report) - return unless mod? - ModerationVote.find_by(user: self, report: report).destroy - end - - def report_voted?(report) - return false unless mod? - report.moderation_votes.each { |s| return true if s.user_id == self.id } - false - end - - # @param upvote [Boolean] - def report_x_voted?(report, upvote) - return false unless mod? - report.moderation_votes.where(upvote: upvote).each { |s| return true if s.user_id == self.id } - false - end - def report_comment(report, content) ModerationComment.create!(user: self, report: report, content: content) end