diff --git a/libervia/backend/plugins/plugin_misc_lists.py b/libervia/backend/plugins/plugin_misc_lists.py index f3b2e45b..3a1db99e 100644 --- a/libervia/backend/plugins/plugin_misc_lists.py +++ b/libervia/backend/plugins/plugin_misc_lists.py @@ -322,13 +322,23 @@ class PubsubLists: @param extra(dict, None): same as for [XEP-0060.send_item] with additional keys: - update(bool): if True, get previous item data to merge with current one if True, item_id must be set + - comments(bool): indicate if a new comment node must be created. + If True a new comment node will be create, and replace existing one if + there is already one. + If not set, comment node will be create if not ``item_id`` is specified, + and won't be modified otherwise. other arguments are same as for [self._s.send_data_form_item] @return (unicode): id of the created item """ if not node: node = self.namespace - if not item_id: + if extra is None: + extra = {} + + # FIXME: presence of a field where comments node can be added must be checked. + add_comments_node = extra.get("comments") + if add_comments_node or (add_comments_node is None and not item_id): comments_service = await self._m.get_comments_service(client, service) # we need to use uuid for comments node, because we don't know item id in