aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2020-03-05 13:13:42 -0500
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2020-03-05 13:13:42 -0500
commit58d09aafb35dbd034b13de4f1b7299c3154bb9d7 (patch)
tree196e88060e08c3d8ff4e389d620578fed636ebdd /lib
parent563d9ddf23ead37693dd33afb4acbd234a9c7670 (diff)
downloadpatchfoo-58d09aafb35dbd034b13de4f1b7299c3154bb9d7.tar.gz
patchfoo-58d09aafb35dbd034b13de4f1b7299c3154bb9d7.zip
messagesByType: support sort by claimed timestamp
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/app.js b/lib/app.js
index 03e3010..f223745 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -1307,8 +1307,19 @@ App.prototype.sbotCreateUserStream = function (opts) {
}
App.prototype.sbotMessagesByType = function (opts) {
- if (!this.sbot.messagesByType) return pull.error(new Error('missing sbot.messagesByType'))
- return this.sbot.messagesByType(opts)
+ if (opts.sortByTimestamp) {
+ if (!this.sbot.query) {
+ return pull.error(new Error('missing ssb-query'))
+ }
+ return this.filter(this.sbot.query, opts, {
+ value: {content: {type: opts.type}}
+ })
+ } else {
+ if (!this.sbot.messagesByType) {
+ return pull.error(new Error('missing sbot.messagesByType'))
+ }
+ return this.sbot.messagesByType(opts)
+ }
}
App.prototype.getThread = function (msg) {