Software /
code /
prosody
Comparison
util/pubsub.lua @ 9202:27d800ddc3b0
util.pubsub: get_last_item(): Fail with item-not-found if no item yet published
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 18 Aug 2018 14:21:02 +0100 |
parent | 9201:1555ea0d6f61 |
child | 9203:c65bfddd3cc5 |
comparison
equal
deleted
inserted
replaced
9201:1555ea0d6f61 | 9202:27d800ddc3b0 |
---|---|
596 if not self:may(node, actor, "get_items") then | 596 if not self:may(node, actor, "get_items") then |
597 return false, "forbidden"; | 597 return false, "forbidden"; |
598 end | 598 end |
599 -- | 599 -- |
600 | 600 |
601 -- Check node exists | 601 -- Check node exists and has an item published |
602 if not self.nodes[node] then | 602 if not (self.nodes[node] and self.data[node]) then |
603 return false, "item-not-found"; | 603 return false, "item-not-found"; |
604 end | 604 end |
605 | 605 |
606 -- Returns success, id, item | 606 -- Returns success, id, item |
607 return true, self.data[node]:tail(); | 607 return true, self.data[node]:tail(); |