diff options
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) { |