Commit 99572cfcce0be3f08b38bdb02f3f3d541c7e8d55
1 parent
d370a0e684
Exists in
master
unpull before reporting
Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff
flashcards/models.py
View file @
99572cf
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | + | |
19 | 20 | # Hack to fix AbstractUser before subclassing it |
20 | 21 | |
21 | 22 | AbstractUser._meta.get_field('email')._unique = True |
... | ... | @@ -86,7 +87,6 @@ |
86 | 87 | flashcards.notifications.notify_score_change(flashcard) |
87 | 88 | flashcards.notifications.notify_pull(flashcard) |
88 | 89 | |
89 | - | |
90 | 90 | def unpull(self, flashcard): |
91 | 91 | if not self.is_in_section(flashcard.section): |
92 | 92 | raise ValueError("User not in the section this flashcard belongs to") |
... | ... | @@ -251,6 +251,7 @@ |
251 | 251 | return self |
252 | 252 | |
253 | 253 | def report(self, user, reason=None): |
254 | + if self.is_in_deck(user): user.unpull(self) | |
254 | 255 | obj, created = FlashcardHide.objects.get_or_create(user=user, flashcard=self) |
255 | 256 | obj.reason = reason |
256 | 257 | obj.save() |