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

Tom Hughes notifications at github.com
Wed Mar 14 17:51:40 UTC 2018


tomhughes 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

I don't think it's work such crazy names as that certainly so I guess we just leave it if we keep the thing at all.

-- 
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_r174552522
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20180314/84082426/attachment-0001.html>


More information about the rails-dev mailing list