diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2018-03-17 10:55:14 +0100 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2018-03-17 10:59:34 +0100 |
commit | 7ba6fae67cd3ba845e9d07dbc562d49fe108550d (patch) | |
tree | 969041ce3da54b75196c8c6547d5c81078326ebb | |
parent | Fix result of XEP-0060 §6.5.9.12 (#2288) (diff) |
Improve result of XEP-0060 §6.5.9.12 (#2288)
Moving get_item result control to keep item-not-found on transaction
error when node does not exists
-rw-r--r-- | src/mod_pubsub.erl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index eb5ee8cc..666ea41e 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -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) -> |