Remove cache for org member check

This commit is contained in:
cuom1999 2024-08-08 10:45:03 +07:00
parent 48d0a58dae
commit cdbed121cd
3 changed files with 0 additions and 6 deletions

View file

@ -157,11 +157,9 @@ class Organization(models.Model):
def get_submissions_url(self): def get_submissions_url(self):
return reverse("organization_submissions", args=(self.id, self.slug)) return reverse("organization_submissions", args=(self.id, self.slug))
@cache_wrapper("Oia")
def is_admin(self, profile): def is_admin(self, profile):
return self.admins.filter(id=profile.id).exists() return self.admins.filter(id=profile.id).exists()
@cache_wrapper("Oim")
def is_member(self, profile): def is_member(self, profile):
return profile in self return profile in self

View file

@ -142,8 +142,6 @@ def contest_submission_delete(sender, instance, **kwargs):
@receiver(post_save, sender=Organization) @receiver(post_save, sender=Organization)
def organization_update(sender, instance, **kwargs): def organization_update(sender, instance, **kwargs):
cache.delete_many([make_template_fragment_key("organization_html", (instance.id,))]) 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] _misc_config_i18n = [code for code, _ in settings.LANGUAGES]

View file

@ -580,7 +580,6 @@ class JoinOrganization(OrganizationMembershipChange):
profile.organizations.add(org) profile.organizations.add(org)
profile.save() profile.save()
cache.delete(make_template_fragment_key("org_member_count", (org.id,))) cache.delete(make_template_fragment_key("org_member_count", (org.id,)))
Organization.is_member.dirty(org, profile)
class LeaveOrganization(OrganizationMembershipChange): class LeaveOrganization(OrganizationMembershipChange):
@ -593,7 +592,6 @@ class LeaveOrganization(OrganizationMembershipChange):
) )
profile.organizations.remove(org) profile.organizations.remove(org)
cache.delete(make_template_fragment_key("org_member_count", (org.id,))) cache.delete(make_template_fragment_key("org_member_count", (org.id,)))
Organization.is_member.dirty(org, profile)
class OrganizationRequestForm(Form): class OrganizationRequestForm(Form):