changeset 619:1de01a2154e2

plugin group blog: getItems for comments fixed when we are the publisher of the parent node
author Goffi <goffi@goffi.org>
date Mon, 17 Jun 2013 13:55:11 +0200
parents e2c33a16d235
children 64db6758d223
files src/plugins/plugin_misc_groupblog.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_misc_groupblog.py	Mon Jun 17 13:30:57 2013 +0200
+++ b/src/plugins/plugin_misc_groupblog.py	Mon Jun 17 13:55:11 2013 +0200
@@ -352,11 +352,12 @@
             gbdata = self.item2gbdata(item)
             ret.append(gbdata)
             # if there is a comments node, we subscribe to it
-            if "comments_node" in gbdata and pub_jid.userhostJID() != client.jid.userhostJID():
+            if "comments_node" in gbdata:
                 try:
-                    # every comments node must be subscribed
-                    self.host.plugins["XEP-0060"].subscribe(jid.JID(gbdata["comments_service"]), gbdata["comments_node"],
-                                                            profile_key=client.profile)
+                    # every comments node must be subscribed, except if we are the publisher (we are already subscribed in this case)
+                    if pub_jid.userhostJID() != client.jid.userhostJID():
+                        self.host.plugins["XEP-0060"].subscribe(jid.JID(gbdata["comments_service"]), gbdata["comments_node"],
+                                                                profile_key=client.profile)
                     # we get all comments of the node, and handle them
                     defer_getItems = self.host.plugins["XEP-0060"].getItems(jid.JID(gbdata["comments_service"]), gbdata["comments_node"], profile_key=client.profile)
                     defer_getItems.addCallback(self._handleCommentsItems, jid.JID(gbdata["comments_service"]), gbdata["comments_node"], client.profile)