aboutsummaryrefslogtreecommitdiff
path: root/lib/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/app.js')
-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) {