Commit 321e5e3f authored by Sli's avatar Sli

forum: enhance performances on toggle_favorite

parent 3eb8292d
Pipeline #2017 failed with stage
in 60 minutes and 5 seconds
......@@ -280,7 +280,7 @@ class ForumTopicSubscribeView(CanViewMixin, SingleObjectMixin, RedirectView):
def get(self, request, *args, **kwargs):
self.object = self.get_object()
if request.user in self.object.subscribed_users.all():
if self.object.subscribed_users.filter(id=request.user.id).exists():
self.object.subscribed_users.remove(request.user)
else:
self.object.subscribed_users.add(request.user)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment