cabal-club / cabal-core

Core database and replication for cabal.
GNU Affero General Public License v3.0
303 stars 43 forks source link

moderation.banInfo #77

Closed ghost closed 4 years ago

ghost commented 4 years ago

This patch does some internal reorganization to the fields that listBans() returns so this is a breaking change. But with this change, you can set additional properties such as a reason for a ban message:

      cabal0.publish({
        type: 'ban/add',
        content: { key: key1, reason: 'spammer' }
      })

and then later or on a different synchronized cabal you can read that information back using banInfo():

          cabal2.moderation.banInfo(bans[0].key, function (err, info) {
            t.error(err)
            t.deepEqual(info.content, {
              key: key1,
              reason: 'spammer'
            })
            t.ok(info.timestamp)
          })

This required an upstream change in materialized-group-auth in 1.2.0.

cblgh commented 4 years ago

@substack is this ready to be merged? (as #80 builds on it)

ghost commented 4 years ago

If you merge the other one this should be included by default. It might be worth renaming this to .blockInfo() depending on how the other naming changes work. Or maybe .moreInfo() since it's the same code as .modInfo() and that could be collapsed into a single method.

ghost commented 4 years ago

handled by cabal.getMessage() in #83