]> granicus.if.org Git - ejabberd/commitdiff
Fix getting cached last item (#1814)
authorChristophe Romain <christophe.romain@process-one.net>
Wed, 2 Aug 2017 10:22:13 +0000 (12:22 +0200)
committerChristophe Romain <christophe.romain@process-one.net>
Wed, 2 Aug 2017 10:24:34 +0000 (12:24 +0200)
src/mod_pubsub.erl

index 4a2e20f87bc9c9cc384dab0960a4013025a09973..263b33ab91b137136cd8b35474462014b7c7199e 100644 (file)
@@ -2142,9 +2142,14 @@ get_allowed_items_call(Host, Nidx, From, Type, Options, Owners, RSM) ->
     node_call(Host, Type, get_items, [Nidx, From, AccessModel, PS, RG, undefined, RSM]).
 
 get_last_items(Host, Type, Nidx, LJID, Count) ->
-    case node_action(Host, Type, get_last_items, [Nidx, LJID, Count]) of
-       {result, Items} -> Items;
-       _ -> []
+    case get_cached_item(Host, Nidx) of
+       undefined ->
+           case node_action(Host, Type, get_last_items, [Nidx, LJID, Count]) of
+               {result, Items} -> Items;
+             _ -> []
+           end;
+       LastItem ->
+           [LastItem]
     end.
 
 %% @doc <p>Resend the items of a node to the user.</p>