From cdbed121cd4f26154c1b6c6374d7c5c06b3a3694 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Thu, 8 Aug 2024 10:45:03 +0700 Subject: [PATCH] Remove cache for org member check --- judge/models/profile.py | 2 -- judge/signals.py | 2 -- judge/views/organization.py | 2 -- 3 files changed, 6 deletions(-) diff --git a/judge/models/profile.py b/judge/models/profile.py index 412e77b..3339791 100644 --- a/judge/models/profile.py +++ b/judge/models/profile.py @@ -157,11 +157,9 @@ class Organization(models.Model): 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 diff --git a/judge/signals.py b/judge/signals.py index c3029bb..a9417bf 100644 --- a/judge/signals.py +++ b/judge/signals.py @@ -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] diff --git a/judge/views/organization.py b/judge/views/organization.py index 788a1b4..882c820 100644 --- a/judge/views/organization.py +++ b/judge/views/organization.py @@ -580,7 +580,6 @@ class JoinOrganization(OrganizationMembershipChange): 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): @@ -593,7 +592,6 @@ class LeaveOrganization(OrganizationMembershipChange): ) profile.organizations.remove(org) cache.delete(make_template_fragment_key("org_member_count", (org.id,))) - Organization.is_member.dirty(org, profile) class OrganizationRequestForm(Form):