From e51129d36f0ba88119e82bed03e71615a7c47327 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Fri, 29 Apr 2022 15:27:25 -0500 Subject: [PATCH] Fix race in chat ignore --- chat_box/models.py | 4 ++-- judge/models/problem.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/chat_box/models.py b/chat_box/models.py index 5958347..1a62171 100644 --- a/chat_box/models.py +++ b/chat_box/models.py @@ -58,8 +58,8 @@ class Ignore(models.Model): @classmethod def get_ignored_users(self, user): try: - return self.objects.get(user=user).ignored_users.all() - except Ignore.DoesNotExist: + return self.objects.filter(user=user)[0].ignored_users.all() + except: return Profile.objects.none() @classmethod diff --git a/judge/models/problem.py b/judge/models/problem.py index 1d6fc0e..a4ee885 100644 --- a/judge/models/problem.py +++ b/judge/models/problem.py @@ -406,6 +406,7 @@ class Problem(models.Model): ('change_public_visibility', 'Change is_public field'), ('change_manually_managed', 'Change is_manually_managed field'), ('see_organization_problem', 'See organization-private problems'), + ('suggest_problem_changes', 'Suggest changes to problem'), ) verbose_name = _('problem') verbose_name_plural = _('problems')