]> granicus.if.org Git - ejabberd/commitdiff
Improve result of XEP-0060 ยง6.5.9.12 (#2288)
authorChristophe Romain <christophe.romain@process-one.net>
Sat, 17 Mar 2018 09:55:14 +0000 (10:55 +0100)
committerChristophe Romain <christophe.romain@process-one.net>
Sat, 17 Mar 2018 09:59:34 +0000 (10:59 +0100)
Moving get_item result control to keep item-not-found on transaction
error when node does not exists

src/mod_pubsub.erl

index eb5ee8ccb964cb187dbc72c0e0326c8f4b122574..666ea41ee83a6d7f7682ff63b218081fe94eae67 100644 (file)
@@ -1999,8 +1999,12 @@ get_items(Host, Node, From, SubId, _MaxItems, ItemIds, RSM) ->
                                     Host, From, Owners, AccessModel, AllowedGroups),
                        case ItemIds of
                            [ItemId] ->
-                               node_call(Host, Type, get_item,
-                                         [Nidx, ItemId, From, AccessModel, PS, RG, undefined]);
+                               case node_call(Host, Type, get_item,
+                                              [Nidx, ItemId, From, AccessModel, PS, RG, undefined])
+                               of
+                                   {error, _} -> {result, {[], undefined}};
+                                   Result -> Result
+                               end;
                            _ ->
                                node_call(Host, Type, get_items,
                                          [Nidx, From, AccessModel, PS, RG, SubId, RSM])
@@ -2026,10 +2030,8 @@ get_items(Host, Node, From, SubId, _MaxItems, ItemIds, RSM) ->
            {result,
             #pubsub{items = #ps_items{node = Node,
                                       items = itemsEls([Item])}}};
-       _ ->
-           {result,
-            #pubsub{items = #ps_items{node = Node,
-                                      items = itemsEls([])}}}
+       Error ->
+           Error
     end.
 
 get_items(Host, Node) ->