Hide comments when parent resource is hidden#13554
Merged
andreslucena merged 24 commits intodecidim:developfrom Feb 24, 2025
Merged
Hide comments when parent resource is hidden#13554andreslucena merged 24 commits intodecidim:developfrom
andreslucena merged 24 commits intodecidim:developfrom
Conversation
alecslupu
suggested changes
Oct 16, 2024
Contributor
alecslupu
left a comment
There was a problem hiding this comment.
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
Contributor
|
@andreslucena this is ready to a second round |
Alex took over this PR so he'll not review it
This was referenced Feb 24, 2025
andreslucena
added a commit
that referenced
this pull request
Mar 3, 2025
* 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>
This was referenced Mar 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 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
