Skip to content

Commit

Permalink
Merge pull request #110 from ssbc/pass-along-publish-opts
Browse files Browse the repository at this point in the history
Pass along options given to publish
  • Loading branch information
Powersource committed Nov 28, 2023
2 parents 53375b9 + f91d2ca commit 01d1fe3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The secret stack option `config.box2.legacyMode` also needs to be `true`.

### `ssb.tribes.publish(content, cb)`

A wrapper around `ssb.db.create` that makes sure you have correct tangles (if relevant) in your message. Mutates `content`. You need to put recipients in `content.recps` if you want it to be encrypted.
A wrapper around `ssb.db.create` that makes sure you have correct tangles (if relevant) in your message. Mutates `content`. You need to put recipients in `content.recps`.

### `ssb.tribes.create(opts, cb)`

Expand Down
6 changes: 1 addition & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,7 @@ function init (ssb, config) {
const getMembersTangle = GetGroupTangle(ssb, null, 'members')

const tribePublish = (content, cb) => {
if (!content.recps) {
return ssb.db.create({
content
}, cb)
}
if (!content.recps) return cb(Error('tribes.publish requires content.recps'))

if (!isGroup(content.recps[0])) {
return ssb.db.create({
Expand Down
1 change: 0 additions & 1 deletion test/publish.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ test('publish (DMs: myFeedId + feedId)', async t => {

try {
const msg = await p(alice.tribes.publish)(content)
await p(alice.tribes.publish)({ type: 'doop' })
t.true(msg.value.content.endsWith('.box2'), 'publishes envelope cipherstring')

const aliceGet = await p(alice.get)({ id: msg.key, private: true, meta: true })
Expand Down

0 comments on commit 01d1fe3

Please sign in to comment.