Update OpenSearch upon item removal from Moderation Dashboard#3366
Update OpenSearch upon item removal from Moderation Dashboard#3366michaelcanova wants to merge 8 commits intomainfrom
Conversation
…kend into opensearch_clear_on_remove
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3366 +/- ##
==========================================
+ Coverage 79.40% 79.43% +0.02%
==========================================
Files 638 639 +1
Lines 37081 37114 +33
==========================================
+ Hits 29446 29483 +37
+ Misses 7635 7631 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…kend into opensearch_clear_on_remove
|
|
|
||
| @patch("discussion.views.remove_from_search_index") | ||
| def test_resolves_unified_document_to_inner_doc(self, mock_remove): | ||
| from discussion.views import censor |
| class TestCensorUnifiedDocument(TestCase): | ||
|
|
||
| @patch("discussion.views.remove_from_search_index") | ||
| def test_resolves_unified_document_to_inner_doc(self, mock_remove): |
| sync_search_index(Paper.objects.filter(is_removed=True)) | ||
| sync_search_index( | ||
| ResearchhubPost.objects.filter(unified_document__is_removed=True) | ||
| ) |
There was a problem hiding this comment.
This queryset will grow large over time which will cause large amounts of registry updates redundantly.
gzurowski
left a comment
There was a problem hiding this comment.
The change couples discussion, hub, paper, RH document with the search app that already depends on those, creating a dependency circle between these modules. I would prefer a solution that doesn't introduce this form of coupling.



Overview
This PR adds functionality to clear OpenSearch when items are removed from the Moderation Dashboard
1. If an individual item is removed (Remove button), it will remove that item
2. If a user is removed (Remove + Suspend) all items pertaining to that user will be removed