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

user_moderation: user search for fetching user communities #1204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

slint
Copy link
Member

@slint slint commented Sep 5, 2024

  • Uses search results to determine a blocked/restored user's
    communities.
  • Uses TaskOp and Unit of Work for sending off action tasks.

* Uses search results to determine a blocked/restored user's
  communities.
* Uses TaskOp and Unit of Work for sending off action tasks.
Comment on lines +29 to +42
if from_db:
query = db.session.query(mem_model_cls.community_id).filter(
mem_model_cls.user_id == user_id,
mem_model_cls.role == "owner",
)
return (row[0] for row in query.yield_per(1000))
else:
search = (
RecordsSearchV2(index=mem_cls.index._name)
.filter("term", user_id=user_id)
.filter("term", role="owner")
.source(["community_id"])
)
return (hit["community_id"] for hit in search.scan())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major: Hmm I think we are missing the filtering for the communities that are owned solely by the user, unless I am missing something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, this doesn't check anymore if the user is the only owner. Part of the change was to improve on the overall performance (before there was some in-memory overfetching). I think adding the check back is not that big of a performance hit, so I'll have a go at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready
Development

Successfully merging this pull request may close these issues.

2 participants