-
Notifications
You must be signed in to change notification settings - Fork 91
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
feat: implement club announcement restrictions #1733
base: dev
Are you sure you want to change the base?
Conversation
9756ac5
to
56c379c
Compare
So it seems fine performance-wise. But I think you need to be more careful and check everywhere this query is used. I'm not sure that this one instance will cover everything. Basically, shore it up some more.
|
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.
see above
41712e0
to
ebd1345
Compare
ebd1345
to
3515943
Compare
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.
Thanks Aarush, great work and almost done, just a few small changes
intranet/apps/eighth/models.py
Outdated
Returns: | ||
Whether the user can subscribe to the activity. | ||
""" | ||
return user.is_superuser or ( |
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.
for consistency can you make this user.is_eighth_admin?
intranet/apps/eighth/models.py
Outdated
return user.is_superuser or ( | ||
self.subscriptions_enabled | ||
and user.is_authenticated | ||
and (not self.restricted or (user in self.users_allowed.all() or user.groups.filter(id__in=self.groups_allowed.all()).exists())) |
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.
user in self.users_allowed.all() can also be replaced with a .filter(...).exists()
@@ -111,6 +124,10 @@ class Announcement(models.Model): | |||
added = models.DateTimeField(auto_now_add=True) | |||
updated = models.DateTimeField(auto_now=True) | |||
groups = models.ManyToManyField(DjangoGroup, blank=True) | |||
public = models.BooleanField( | |||
default=False, | |||
help_text="Whether to show the announcement, even if the club is restricted (club announcements only)", |
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 think this should be more clear. it should be to show the announcement publicly to all users. right now it sounds like nobody can see the announcement if it is restricted...
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.
also it would be good if you can make it clearer that restricted activities have announcements restricted to members of the allowed list by default
3515943
to
5024ae7
Compare
This makes it so that announcements that are created by a restricted club are only shown to people who are allowed to access the restricted club.