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

Matt Amos notifications at github.com
Tue Feb 28 11:06:03 UTC 2017

> > @zerebubuth identified tests as one thing that's missing, but there's probably other stuff.
> @zerebubuth : did you use @Zverik remarks, or is this work still to do ?

I started off with getting `rubocop` to pass, which would have addressed most of @Zverik's formatting remarks. I wanted to cover all the existing functionality, but didn't get anywhere near that. IIRC, I only fixed the few tests that there already were.

Writing tests is a good way to start; partly because there weren't enough tests before, and partly because writing tests can be a good way to understand how the code works.

There is a lot of new code, spread over a lot of changes to existing files and I found it hard to navigate all of it. I think there is a good argument for re-examining the goals of this code and perhaps starting from scratch, or at least laying down some broad design ideas and cleaning up the code so that it's more consistent, readable and isolated from existing code.

When adding this sort of functionality, I think the "Rails-y" way of doing it would be to add an [`acts_as` plugin](http://guides.rubyonrails.org/plugins.html#add-an-acts-as-method-to-active-record), called something like `acts_as_flaggable` or `acts_as_reportable`, and use that to keep the code for reporting problems and moderating them separate from the existing code. This would be more readable and allow the testing of that functionality separated from the context it's used in.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20170228/ef419502/attachment.html>

More information about the rails-dev mailing list