-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix/8694r3yfv community enhancement with privacy #85
Fix/8694r3yfv community enhancement with privacy #85
Conversation
Reviewer's Guide by SourceryThis pull request implements several enhancements to the community feature, focusing on privacy improvements and user experience. The changes include adding a custom 403 error page, improving community list view to show private communities, enhancing moderator management, and adding success messages for various actions. File-Level Changes
Tips
|
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.
Hey @memorisanka - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
@@ -191,7 +206,13 @@ | |||
remove_moderator_form = RemoveModeratorForm(request.POST) | |||
if remove_moderator_form.is_valid(): | |||
user = remove_moderator_form.cleaned_data["nickname"] | |||
if not CommunityMember.objects.filter( |
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.
suggestion (performance): Consider combining the moderator check with the remove_moderator operation.
The current implementation performs an additional database query to check if the user is a moderator before calling remove_moderator. Consider combining these operations to avoid unnecessary database queries, possibly by handling the case in the remove_moderator method itself.
try:
moderator = CommunityMember.objects.get(
community=self.object, user=user, role=CommunityMember.MODERATOR
)
self.object.remove_moderator(moderator)
except CommunityMember.DoesNotExist:
# Handle the case where the user is not a moderator
pass
I have no clue why the custom 403 page is not working. Any ideas? :) |
@memorisanka so the tests fails and there is good reason for it. Please update the 403 page to something generic, like "you don't have access to this content" or something generic. And update the failing test with it. |
…tps://github.com/pymasterspl/reddit into fix/8694r3yfv-community-enhancement-with-privacy
The test is fixed :) |
https://app.clickup.com/t/8695gbbqh
https://app.clickup.com/t/8695gbc7n
https://app.clickup.com/t/8695gbgxm
Hi everyone!
I have added some bug fixes. Could you check it? :)
Summary by Sourcery
Implement a custom 403 permission denied view and enhance community privacy features by displaying access restrictions. Add validation and messaging for moderator management, and introduce a user-friendly 403 error page. Include tests to ensure correct handling of non-existing moderator removal.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: