Skip to content
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

Merged
merged 25 commits into from Sep 28, 2022
Merged

Conversation

antopalidi
Copy link
Member

@antopalidi antopalidi commented Sep 20, 2022

screen

  • 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

@antopalidi antopalidi marked this pull request as draft September 21, 2022 10:33
@antopalidi antopalidi marked this pull request as ready for review September 26, 2022 17:48
@microstudi microstudi linked an issue Sep 27, 2022 that may be closed by this pull request
7 tasks
# Conflicts:
#	lib/decidim/reporting_proposals/engine.rb
#	spec/lib/overrides_spec.rb
Copy link
Contributor

@microstudi microstudi left a 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!

config/locales/en.yml Outdated Show resolved Hide resolved
lib/decidim/proposals/admin_engine.rb Outdated Show resolved Hide resolved
lib/decidim/reporting_proposals/component.rb Outdated Show resolved Hide resolved
lib/decidim/reporting_proposals/engine.rb Outdated Show resolved Hide resolved
lib/decidim/reporting_proposals/engine.rb Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Base: 95.72% // Head: 95.21% // Decreases project coverage by -0.50% ⚠️

Coverage data is based on head (a2a16dd) compared to base (fc34321).
Patch coverage: 93.75% of modified lines in pull request are covered.

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     
Impacted Files Coverage Δ
...idim/reporting_proposals/create_report_override.rb 66.66% <66.66%> (ø)
.../reporting_proposals/admin/proposals_controller.rb 92.85% <92.85%> (ø)
.../reporting_proposals/admin/hide_flag_modal_cell.rb 100.00% <100.00%> (ø)
...eporting_proposals/admin/application_controller.rb 100.00% <100.00%> (ø)
lib/decidim/reporting_proposals.rb 100.00% <100.00%> (ø)
lib/decidim/reporting_proposals/admin.rb 100.00% <100.00%> (ø)
lib/decidim/reporting_proposals/admin_engine.rb 100.00% <100.00%> (ø)
lib/decidim/reporting_proposals/config.rb 100.00% <100.00%> (ø)
lib/decidim/reporting_proposals/engine.rb 100.00% <100.00%> (ø)

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@microstudi microstudi 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!

@microstudi microstudi merged commit 78192dc into main Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide proposals without reporting
3 participants