-
-
Notifications
You must be signed in to change notification settings - Fork 409
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
base: develop
Are you sure you want to change the base?
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>
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.
I've tired it out locally with Sidekiq running and the comments seem to still exist in the general search even when the Proposal is hidden...
🎩 What? Why?
Added a new method
HideChildeResourcesJob
to 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_resources
to hide all the comments from previously hidden resources.📌 Related Issues
Testing
📷 Screenshots
Please add screenshots of the changes you are proposing