Просмотр исходного кода

Sync last thread name on forums table on thread edition #107

Ralfp 12 лет назад
Родитель
Сommit
362077e61b
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      misago/apps/threadtype/posting/editthread.py

+ 4 - 0
misago/apps/threadtype/posting/editthread.py

@@ -50,6 +50,10 @@ class EditThreadBaseView(PostingBaseView):
             self.thread.name = form.cleaned_data['thread_name']
             self.thread.slug = slugify(form.cleaned_data['thread_name'])
             self.thread.save(force_update=True)
+            if self.forum.last_thread_id == self.thread.pk:
+                self.forum.last_thread_name = self.thread.name
+                self.forum.last_thread_slug = self.thread.slug
+                self.forum.save(force_update=True)
 
         if changed_post:
             self.post.post = form.cleaned_data['post']