Skip to content

Commit

Permalink
Remove cache for org member check
Browse files Browse the repository at this point in the history
  • Loading branch information
cuom1999 committed Aug 8, 2024
1 parent 48d0a58 commit cdbed12
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 6 deletions.
2 changes: 0 additions & 2 deletions judge/models/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,9 @@ def get_contests_url(self):
def get_submissions_url(self):
return reverse("organization_submissions", args=(self.id, self.slug))

@cache_wrapper("Oia")
def is_admin(self, profile):
return self.admins.filter(id=profile.id).exists()

@cache_wrapper("Oim")
def is_member(self, profile):
return profile in self

Expand Down
2 changes: 0 additions & 2 deletions judge/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ def contest_submission_delete(sender, instance, **kwargs):
@receiver(post_save, sender=Organization)
def organization_update(sender, instance, **kwargs):
cache.delete_many([make_template_fragment_key("organization_html", (instance.id,))])
for admin in instance.admins.all():
Organization.is_admin.dirty(instance, admin)


_misc_config_i18n = [code for code, _ in settings.LANGUAGES]
Expand Down
2 changes: 0 additions & 2 deletions judge/views/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,6 @@ def handle(self, request, org, profile):
profile.organizations.add(org)
profile.save()
cache.delete(make_template_fragment_key("org_member_count", (org.id,)))
Organization.is_member.dirty(org, profile)


class LeaveOrganization(OrganizationMembershipChange):
Expand All @@ -593,7 +592,6 @@ def handle(self, request, org, profile):
)
profile.organizations.remove(org)
cache.delete(make_template_fragment_key("org_member_count", (org.id,)))
Organization.is_member.dirty(org, profile)


class OrganizationRequestForm(Form):
Expand Down

0 comments on commit cdbed12

Please sign in to comment.