Rafał Pitoń 11 лет назад
Родитель
Сommit
ecc86a021b

+ 14 - 12
misago/apps/threadtype/posting/base.py

@@ -84,18 +84,20 @@ class PostingBaseView(ViewBase):
         self.email_watchers(notified_users)
 
     def watch_thread(self):
-        if self.request.user.subscribe_start:
-            try:
-                WatchedThread.objects.get(user=self.request.user, thread=self.thread)
-            except WatchedThread.DoesNotExist:
-                WatchedThread.objects.create(
-                                           user=self.request.user,
-                                           forum=self.forum,
-                                           thread=self.thread,
-                                           starter_id=self.thread.start_poster_id,
-                                           last_read=timezone.now(),
-                                           email=(self.request.user.subscribe_start == 2),
-                                           )
+        pass
+
+    def start_watching_thread(self, email_notifications=False):
+        try:
+            WatchedThread.objects.get(user=self.request.user, thread=self.thread)
+        except WatchedThread.DoesNotExist:
+            WatchedThread.objects.create(
+                                       user=self.request.user,
+                                       forum=self.forum,
+                                       thread=self.thread,
+                                       starter_id=self.thread.start_poster_id,
+                                       last_read=timezone.now(),
+                                       email=email_notifications,
+                                       )
 
     def make_attachments_token(self):
         if self.post:

+ 6 - 1
misago/apps/threadtype/posting/newreply.py

@@ -135,4 +135,9 @@ class NewReplyBaseView(PostingBaseView):
                     alert = user.alert(ugettext_lazy("%(username)s has replied to thread %(thread)s that you are watching").message)
                 alert.profile('username', self.request.user)
                 alert.post('thread', self.type_prefix, self.thread, self.post)
-                alert.save_all()
+                alert.save_all()
+
+    def watch_thread(Self):
+        if self.request.user.subscribe_reply:
+            self.start_watching_thread(
+                self.request.user.subscribe_reply == 2)

+ 6 - 1
misago/apps/threadtype/posting/newthread.py

@@ -82,4 +82,9 @@ class NewThreadBaseView(PostingBaseView):
             self.request.user.threads += 1
             self.request.user.posts += 1
         self.request.user.last_post = now
-        self.request.user.save(force_update=True)
+        self.request.user.save(force_update=True)
+
+    def watch_thread(Self):
+        if self.request.user.subscribe_start:
+            self.start_watching_thread(
+                self.request.user.subscribe_start == 2)