Skip to content

Detect the use of spam-bots and ban non compliant users (part 1)#6696

Merged
tramuntanal merged 27 commits intodecidim:developfrom
i-need-another-coffee:feature/add-report-user-functionality
Nov 13, 2020
Merged

Detect the use of spam-bots and ban non compliant users (part 1)#6696
tramuntanal merged 27 commits intodecidim:developfrom
i-need-another-coffee:feature/add-report-user-functionality

Conversation

@roxanaopr
Copy link
Copy Markdown
Contributor

@roxanaopr roxanaopr commented Oct 16, 2020

🎩 What? Why?

Implement a way to report users

Like we have a way to flag a contribution for moderation, a similar mechanism can be implemented to flag users and give moderators the ability to block said user. Everyone can participate in this reporting (admin, moderators, users) and flag users based on their harmful behaviour towards the debate or the content they posted on they public profile (avatar, biography, personal website).

Add a flag to report users on their public profile;
In the admin, add a column to the participant table that displays the number of time a user was reported and make a sortable column so the admin can see first the ones with most reports and take action (block) if needed;
Send notification to moderator and admin when a user is reported.

📌 Related Issues

Meta Decidim: https://meta.decidim.org/processes/roadmap/f/122/proposals/15628

Testing

  1. Open the website, browse the homepage for an event that has an username
  2. Navigate the username profile page, and observe the flag button
  3. Click Report (flag icon near nickname), and fill in the data (or login and retry)
  4. Navigate to admin Interface in "Participants" -> "Reported Users"
  5. Observe the user details (username, reason, justification)
  6. Visiting the Participants section, the report count column should be sortable, and shoud display 1 in the corresponding user row
  7. Click the unreport functionality, and observe what is happening
    8 Navigate to Participants section, and now the report count should indicate 0

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

📷 Screenshots

Please add screenshots of the changes you're proposing
Description
image
image
image
image
image

♥️ Thank you!

@roxanaopr roxanaopr marked this pull request as draft October 16, 2020 09:34
@roxanaopr roxanaopr marked this pull request as ready for review October 16, 2020 11:47
@alecslupu
Copy link
Copy Markdown
Contributor

The failing test is the flacky one related to maps.
@decidim/core, can you retry that specific job ?

@tramuntanal
Copy link
Copy Markdown
Contributor

Welcome @roxanaopr on what I think is your first PR!
I've re-run the test @alecslupu
@decidim/product I see in meta-decidim that it has been approved, but can you confirm this partial implementation of the feature?

@roxanaopr
Copy link
Copy Markdown
Contributor Author

Welcome @roxanaopr on what I think is your first PR!
I've re-run the test @alecslupu
@decidim/product I see in meta-decidim that it has been approved, but can you confirm this partial implementation of the feature?

Hi @tramuntanal! This pull request is only for part 1 (Implement a way to report users) of the meta-decidim request. For the rest of it we have/will have other PRs

@tramuntanal
Copy link
Copy Markdown
Contributor

ok, thanks for the feedback @roxanaopr , waiting for @decidim/product 's feedback

@carolromero
Copy link
Copy Markdown
Member

Hi there! I confirm this is approved by @decidim/product. One detail, could we place the icons so that they are not so tight? Something like that?
imatge
Thanks!

@alecslupu
Copy link
Copy Markdown
Contributor

@carolromero the change requested has been implemented ...

image

@carolromero
Copy link
Copy Markdown
Member

Thanks, @alecslupu!

@tramuntanal tramuntanal self-assigned this Nov 10, 2020
Copy link
Copy Markdown
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job @roxanaopr!
I've just found some commented code to be removed 😄
Also I'm not sure if decidim-core/app/cells/decidim/author/flag_user.erb should directly render decidim/shared/flag_user_modal (because the flag_user may be rendered more than once in the same screen) but for consistency we should encapsulate it into a author_cell#flag_user_modal method, don't you think? 🤔

Comment on lines +5 to +10
<%=
render partial: "decidim/shared/flag_user_modal", locals: {
reportable: profile_holder,
form: report_form,
url: decidim.report_user_path(sgid: profile_holder.to_sgid.to_s)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be rendered by decidim-core/app/cells/decidim/author/flag_user.erb?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tricky part is that report_form, that is being initialized in the controller part.

Comment on lines +11 to +16
<%=
render partial: "decidim/shared/flag_user_modal", locals: {
reportable: user,
form: report_form,
url: decidim.report_user_path(sgid: user.to_sgid.to_s)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be rendered by decidim-core/app/cells/decidim/author/flag_user.erb?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tricky part is that report_form, that is being initialized in the controller part.

Comment on lines +10 to +15
<%=
render partial: "decidim/shared/flag_user_modal", locals: {
reportable: user,
form: report_form,
url: decidim.report_user_path(sgid: user.to_sgid.to_s)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be rendered by decidim-core/app/cells/decidim/author/flag_user.erb?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tricky part is that report_form, that is being initialized in the controller part.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We pass it as a parameter, no?

@alecslupu alecslupu force-pushed the feature/add-report-user-functionality branch from 9621427 to 075bff2 Compare November 12, 2020 22:58
Copy link
Copy Markdown
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the refactor @alecslupu @roxanaopr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants