Best way to create a report/spam button?
Just looking for ideas on the best way to create a report or spam button/link on posts and comments. And do you typically have that notification sent to an in program inbox to an admin email, etc.
Thanks,
Ryan
@ryan it is pretty straight-forward. Typically you count how many times that button is pushed (if it is user facing) and then start applying rules based on that count to auto-remove and what not. You could do that with a simple counter on the model in question. Just have it do it via AJAX and it will be a smooth and nice interaction.
On the other hand if this is admin facing and just flags the comment/post then I would create a table called flags or something like that and it could store the type as a string ("spam" or "reported") and then contain the model name and id (polymorphic). This would give you a list of all the comments/posts that had been flagged or reported and allow you to do whatever you wanted with them.
In actuality the second approach is probably the most flexible since it allows any model to be reported or be considered a spam entry. The only difference is you would be the counter on that model if the UX was user facing.
Anyway, that is a couple of ways to do it. Hope it helps!