Commit 58d09aafb35dbd034b13de4f1b7299c3154bb9d7
messagesByType: support sort by claimed timestamp
cel committed on 3/5/2020, 6:13:42 PMParent: 563d9ddf23ead37693dd33afb4acbd234a9c7670
Files changed
lib/app.js | changed |
lib/app.js | ||
---|---|---|
@@ -1306,10 +1306,21 @@ | ||
1306 | 1306 … | return this.sbot.createUserStream(opts) |
1307 | 1307 … | } |
1308 | 1308 … | |
1309 | 1309 … | App.prototype.sbotMessagesByType = function (opts) { |
1310 | - if (!this.sbot.messagesByType) return pull.error(new Error('missing sbot.messagesByType')) | |
1311 | - return this.sbot.messagesByType(opts) | |
1310 … | + if (opts.sortByTimestamp) { | |
1311 … | + if (!this.sbot.query) { | |
1312 … | + return pull.error(new Error('missing ssb-query')) | |
1313 … | + } | |
1314 … | + return this.filter(this.sbot.query, opts, { | |
1315 … | + value: {content: {type: opts.type}} | |
1316 … | + }) | |
1317 … | + } else { | |
1318 … | + if (!this.sbot.messagesByType) { | |
1319 … | + return pull.error(new Error('missing sbot.messagesByType')) | |
1320 … | + } | |
1321 … | + return this.sbot.messagesByType(opts) | |
1322 … | + } | |
1312 | 1323 … | } |
1313 | 1324 … | |
1314 | 1325 … | App.prototype.getThread = function (msg) { |
1315 | 1326 … | return cat([ |
Built with git-ssb-web