git ssb

16+

cel / patchfoo



Commit 58d09aafb35dbd034b13de4f1b7299c3154bb9d7

messagesByType: support sort by claimed timestamp

cel committed on 3/5/2020, 6:13:42 PM
Parent: 563d9ddf23ead37693dd33afb4acbd234a9c7670

Files changed

lib/app.jschanged
lib/app.jsView
@@ -1306,10 +1306,21 @@
13061306 return this.sbot.createUserStream(opts)
13071307 }
13081308
13091309 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 + }
13121323 }
13131324
13141325 App.prototype.getThread = function (msg) {
13151326 return cat([

Built with git-ssb-web