-
-
Notifications
You must be signed in to change notification settings - Fork 441
Hide comments when parent resource is hidden #13554
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 comments when parent resource is hidden #13554
Conversation
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.
This pull request does not contain a valid label. Please add one of the following labels: ['type: feature', 'type: change', 'type: fix', 'type: removal', 'target: developer-experience', 'type: internal']
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.
As of # we also need to patch decidim-ai/lib/decidim/ai/spam_detection/resource/base.rb and change the way resource_hidden? is being implemented.
A suggestion would be:
def resource_hidden?(resource)
resource.class.included_modules.include?(Decidim::Reportable) && resource.hidden? && !spam_reasons.include?(resource.reports&.last.&reason)
end
def spam_reasons
Decidim::Report::REASONS.excluding("parent_hidden")
end
Signed-off-by: andra-panaite <andra.panaite@tremend.com>
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
a1c9117
…mples.rb Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
…remend-cofe/decidim into fix/hiding-comments-of-hidden-proposal
…comments-of-hidden-proposal
|
@andreslucena this is ready to a second round |
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.
👍🏽
Alex took over this PR so he'll not review it
* Hide comments when parent resource is hidden * Resolved comments Signed-off-by: andra-panaite <andra.panaite@tremend.com> * Run linter * Run linter * Added hide_replies method to handle reported comments with replies * Run linter * Resolved comments * Fixed tests * Fix User case * Update decidim-core/lib/decidim/moderation_tools.rb Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Update decidim-core/lib/decidim/core/test/shared_examples/reports_examples.rb Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com> * Apply review recommendations * Add release notes --------- Signed-off-by: andra-panaite <andra.panaite@tremend.com> Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro> Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
🎩 What? Why?
Added a new method
HideChildeResourcesJobto search and hide all comments related to the hidden parent resource and also to hide replies when a parent comment is reported and hidden.Added a new task
decidim:upgrade:clean:hidden_resourcesto hide all the comments from previously hidden resources.📌 Related Issues
Testing
Scenario 1:
Scenario 2:
📷 Screenshots
Please add screenshots of the changes you are proposing
