Repository: zestedesavoir/zds-site

Issue:
[v23] Renommer un contenu l'envoit deux fois dans les flux rss
En jetant un œil aux [flux rss des billets](https://beta.zestedesavoir.com/tribunes/flux/rss/), on se rend compte que le billet `Un gros Troll de plus sur Javascript` est présent 2 fois.

C'est du au fait que j'ai publié la première fois le billet avec un autre nom. A la deuxième publication, le nom a été modifié et ça apparait deux fois inutilement dans les flux rss.


Discussion:

Resolving patch:
diff --git a/zds/tutorialv2/feeds.py b/zds/tutorialv2/feeds.py
--- a/zds/tutorialv2/feeds.py
+++ b/zds/tutorialv2/feeds.py
@@ -23,14 +23,9 @@ def items(self):
         :return: The last (typically 5) contents (sorted by publication date).
         If `self.type` is not `None`, the contents will only be of this type.
         """
-        contents = PublishedContent.objects\
-            .prefetch_related('content')\
-            .prefetch_related('content__authors')
+        contents = PublishedContent.objects.published_contents(self.content_type)[:ZDS_APP['content']['feed_length']]
 
-        if self.content_type is not None:
-            contents = contents.filter(content_type=self.content_type)
-
-        return contents.order_by('-publication_date')[:ZDS_APP['content']['feed_length']]
+        return contents
 
     def item_title(self, item):
         return item.content.title
diff --git a/zds/tutorialv2/managers.py b/zds/tutorialv2/managers.py
--- a/zds/tutorialv2/managers.py
+++ b/zds/tutorialv2/managers.py
@@ -13,26 +13,37 @@ class PublishedContentManager(models.Manager):
     Custom published content manager.
     """
 
-    def last_contents_of_a_member_loaded(self, author, _type=None):
+    def published_contents(self, _type=None):
         """
-        Get contents published by author depends on settings.ZDS_APP['content']['user_page_number']
+        Get contents published order by date.
 
-        :param author:
-        :param _type: subtype to filter request
         :return:
         :rtype: django.db.models.QuerySet
         """
-
         queryset = self.prefetch_related('content') \
             .prefetch_related('content__authors') \
             .prefetch_related('content__subcategory') \
-            .filter(content__authors__in=[author]) \
-            .filter(must_redirect=False)
+            .filter(must_redirect=False) \
+            .order_by('-publication_date')
 
         if _type:
             queryset = queryset.filter(content_type=_type)
 
-        public_contents = queryset.order_by('-publication_date').all()[:settings.ZDS_APP['content']['user_page_number']]
+        return queryset
+
+    def last_contents_of_a_member_loaded(self, author, _type=None):
+        """
+        Get contents published by author depends on settings.ZDS_APP['content']['user_page_number']
+
+        :param author:
+        :param _type: subtype to filter request
+        :return:
+        :rtype: django.db.models.QuerySet
+        """
+        queryset = self.published_contents(_type) \
+            .filter(content__authors__in=[author])
+
+        public_contents = queryset.all()[:settings.ZDS_APP['content']['user_page_number']]
         return public_contents
 
     def last_tutorials_of_a_member_loaded(self, author):


Test patch: