New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide proposals without reporting #8
Conversation
antopalidi
commented
Sep 20, 2022
•
edited
edited
- Add a configuration option for this module Decidim::ReportingProposals.allow_admins_to_hide_proposals
- If configuration active, override the view when managing a proposal in the admin, add a button saying "hide this proposal" (the flag in the mockup). Show the same modal window that appears in the frontend side when you press the "report" flag button.
- Add a controller in this module that handles the action of creating a report and hiding the content (use existing commands CreateReport and/or HideResource from decidim).
- Add a entry to the spec/lib/overrides_spec.rb to keep track of the overriden view file.
- Prevent to generate notifications/emails to other admins if hidden by the admin. Affected user should still receive their notification.
- When hiding, use the same modal with the options on why are you hidding that (can be used as confirmation dialog)
- Add behaviour specs for this
# Conflicts: # lib/decidim/reporting_proposals/engine.rb # spec/lib/overrides_spec.rb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Anna for this great work.
I specially like the new user flow that you created here. Nice.
A part from completing tests, we should change one structural decision here (see comments).
You've decided to override the current proposals engine, I'm not very fond of this, I think is too invasive. I propose to handle the action hide
in house, ie: let's create a custom controller for this: Decidim::ReportingProposals::Admin::ReportingProposalsController
The route for this hide
action should be defined in a new file lib/decidim/reporting_proposals/admin_engine.rb
.
We need to include this file in a new "require" statement in lib/decidim/reporting_proposals.rb
That would be it I think!
app/cells/decidim/reporting_proposals/admin/hide_flag_modal_cell.rb
Outdated
Show resolved
Hide resolved
app/cells/decidim/reporting_proposals/admin/hide_flag_modal_cell.rb
Outdated
Show resolved
Hide resolved
app/commands/decidim/reporting_proposals/create_report_override.rb
Outdated
Show resolved
Hide resolved
app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb
Outdated
Show resolved
Hide resolved
Codecov ReportBase: 95.72% // Head: 95.21% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #8 +/- ##
==========================================
- Coverage 95.72% 95.21% -0.51%
==========================================
Files 10 16 +6
Lines 187 251 +64
==========================================
+ Hits 179 239 +60
- Misses 8 12 +4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good job!