Browse Source

Fixed crash on message edit in private thread.

Ralfp 12 years ago
parent
commit
d65502557f
1 changed files with 9 additions and 5 deletions
  1. 9 5
      misago/apps/privatethreads/mixins.py

+ 9 - 5
misago/apps/privatethreads/mixins.py

@@ -32,11 +32,15 @@ class TypeMixin(object):
         self.thread.participants.exclude(id=self.request.user.id).update(sync_pds=True)
         self.thread.participants.exclude(id=self.request.user.id).update(sync_pds=True)
                 
                 
     def whitelist_mentions(self):
     def whitelist_mentions(self):
-        participants = self.thread.participants.all()
-        mentioned = self.post.mentions.all()
-        for user in self.md.mentions:
-            if user not in participants and user not in mentioned:
-                self.post.mentioned.add(user)
+        try:
+            if self.md.mentions:
+                participants = self.thread.participants.all()
+                mentioned = self.post.mentions.all()
+                for user in self.md.mentions:
+                    if user not in participants and user not in mentioned:
+                        self.post.mentioned.add(user)
+        except AttributeError:
+            pass
 
 
     def threads_list_redirect(self):
     def threads_list_redirect(self):
         return redirect(reverse('private_threads'))
         return redirect(reverse('private_threads'))