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

Andy Allan notifications at github.com
Wed Jul 5 15:35:23 UTC 2017


So I've had a look through this PR today for a few hours, and it's nowhere near ready to merge or deploy. It'll need a ton of work, but I'm prepared to tackle it. Help is always welcome!

The first thing I want to establish is whether the basic data model is what we need, since it's quite different from how I was considering tackling the problem. My approach was going to be along the lines of just one table, let's call it "flags", with `object_id, object_type, user_id, comment, timestamps`. The moderators can then be given a list of objects, ordered by the most flags. They can then press "delete" or "ignore" and all the flags are removed from the database.

This PR creates three new objects:
### Issues
You get one of these for every object that has been reported:
```
      t.string :reportable_type, :null => false
      t.integer :reportable_id, :null => false
      t.integer :reported_user_id, :null => false
      t.integer :status
      t.string :issue_type
      t.datetime :resolved_at
      t.integer :resolved_by
      t.datetime :created_at
      t.datetime :updated_at
      t.integer :updated_by
      t.integer :report_count, :default => 0
      t.timestamps :null => false
```
### Reports
These contain the individual reports from users, so each Issue can have many Reports
```
    create_table :reports do |t|
      t.integer :issue_id
      t.integer :reporter_user_id
      t.text :details
      t.datetime :created_at
      t.datetime :updated_at

      t.timestamps :null => false
    end
```
### Issue Comments
Allows moderators/admins to add comments about an issue
```
    create_table :issue_comments do |t|
      t.integer :issue_id
      t.integer :commenter_user_id
      t.text :body
      t.datetime :created_at
      t.boolean :reassign
      t.timestamps :null => false
    end
```

I'm not sure if all of these things are necessary, or over-engineering? Thoughts welcome.

-- 
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#issuecomment-313140198
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20170705/6f56c4af/attachment-0001.html>


More information about the rails-dev mailing list