diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2020-03-05 13:13:42 -0500 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2020-03-05 13:13:42 -0500 |
commit | 58d09aafb35dbd034b13de4f1b7299c3154bb9d7 (patch) | |
tree | 196e88060e08c3d8ff4e389d620578fed636ebdd /lib | |
parent | 563d9ddf23ead37693dd33afb4acbd234a9c7670 (diff) | |
download | patchfoo-58d09aafb35dbd034b13de4f1b7299c3154bb9d7.tar.gz patchfoo-58d09aafb35dbd034b13de4f1b7299c3154bb9d7.zip |
messagesByType: support sort by claimed timestamp
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.js | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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) { |