[openstreetmap/openstreetmap-website] [WIP] Allow reporting of abusive users to moderators or admins (#1576)

Andy Allan notifications at github.com
Wed Mar 14 07:54:26 UTC 2018


gravitystorm commented on this pull request.



> +  has_many :comments, :class_name => "IssueComment", :dependent => :destroy
+
+  validates :reportable_id, :uniqueness => { :scope => [:reportable_type] }
+
+  ASSIGNED_ROLES = %w[administrator moderator].freeze
+  validates :assigned_role, :presence => true, :inclusion => ASSIGNED_ROLES
+
+  before_validation :set_default_assigned_role
+  before_validation :set_reported_user
+
+  # Check if more statuses are needed
+  enum :status => %w[open ignored resolved]
+
+  scope :with_status, ->(issue_status) { where(:status => statuses[issue_status]) }
+
+  def read_reports

It's a mechanism for highlighting reports which come in after the issue has been resolved. Presumably it's meant for issues that are being ignored, which might be reported again with further information. "read" and "unread" aren't the best names, something like "reports_created_before_issue_was_resolved" and "reports_created_after_issue_was_resolved" would be more accurate.

I have my doubts as to whether this is even a worthwhile concept, compared to just listing all the reports all the time.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1576#discussion_r174375214
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20180314/281d1281/attachment.html>


More information about the rails-dev mailing list