diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-12-27 12:14:31 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-12-29 10:57:44 -1000 |
commit | 2473135971009a727894d210dab0da72569f61a8 (patch) | |
tree | af91fd0489fc0f542a220e2fe40ff31f937acac3 /lib | |
parent | a1fdd6f43395d2a208100cc07a2769a1b684bedf (diff) | |
download | patchfoo-2473135971009a727894d210dab0da72569f61a8.tar.gz patchfoo-2473135971009a727894d210dab0da72569f61a8.zip |
Fix detecting ssb-ooo when patchfoo is loaded as a plugin before it
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.js | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -47,9 +47,7 @@ function App(sbot, config) { this.about = new About(this, sbot.id) this.msgCache = lru(100) this.getMsg = memo({cache: this.msgCache}, getMsgWithValue, sbot) - this.getMsgOoo = sbot.ooo - ? memo({cache: this.msgCache}, sbot.ooo.get) - : function (id, cb) { cb(new Error('missing ssb-ooo plugin')) } + this.getMsgOoo = memo({cache: this.msgCache}, this.getMsgOoo) this.getAbout = memo({cache: this.aboutCache = lru(500)}, this._getAbout.bind(this)) this.unboxContent = memo({cache: lru(100)}, sbot.private.unbox) @@ -184,6 +182,12 @@ App.prototype.getMsgDecrypted = function (key, cb) { }) } +App.prototype.getMsgOoo = function (key, cb) { + var ooo = this.sbot.ooo + if (!ooo) return cb(new Error('missing ssb-ooo plugin')) + ooo.get(key, cb) +} + App.prototype.getMsgDecryptedOoo = function (key, cb) { var self = this this.getMsgOoo(key, function (err, msg) { @@ -346,16 +350,6 @@ function getMsgWithValue(sbot, id, cb) { }) } -function getMsgOooWithValueCreate(sbot) { - if (!sbot.ooo) { - var err = new Error('missing ssb-ooo plugin') - return function (id, cb) { - cb(null, err) - } - } - return sbot.ooo.get -} - App.prototype._getAbout = function (id, cb) { var self = this if (!u.isRef(id)) return cb(null, {}) |