vouching thresholds -- with invite DMs

Value

as a security conscious channel admin, i would like to able to raise the number of invites required for a new member to subscribe to a signalboost channel so that i can have more confidence that everyone on the channel is trustworthy

Behavior

edits to existing vouch behavior (done)

GIVEN an admin alice on a channel with VOUCHING OFF

  • WHEN alice issues the command VOUCHING ON
  • THEN the vouch level is set to the default value (1) and alice receives the response: Vouching turned on. Joining this channel will now require an invite.

discovering vouch level (done)

GIVEN an admin alice on a channel with VOUCHING ON

  • WHEN alice sends INFO to the channel

  • THEN she receives a message back that lists VOUCH LEVEL N and documents its behavior

  • WHEN alice sends HELP to the channel

  • THEN she sees the VOUCH LEVEL command and help text

changing vouch level

  • GIVEN an admin alice on a channel with VOUCHING OFF
  • WHEN alice sends VOUCH LEVEL 1
  • THEN she receives the response Vouch level set to 1. It will now take 1 invite for new subscribers to join the channel.
  • AND THEN it will subsequently take 1 invite for new subscribers to join
  • GIVEN an admin alice on a channel with VOUCH LEVEL 1
  • WHEN alice sends VOUCH LEVEL 2
  • THEN she receives a response Vouch level set to 2. It will now take 2 invites for new subscribers to join the channel.
  • AND THEN it will subsequently take 2 invites for new subscribers to join
  • GIVEN an admin alice on a channel with VOUCHING ON (and any vouch level)
  • WHEN alice sends VOUCH LEVEL <invalid> where an invalid level is anything other than an integer between 1 and 10 (eg: "foo", 0, -1, etc.
  • THEN alice receives an error message that says Sorry, <invalid> is not a valid vouch level. Vouch levels must be a number between 1 and 10.

sending invites

with vouch level 1

GIVEN a subscriber alice on a channel with VOUCHING ON and VOUCH LEVEL 1 and a user bob with phone number +15555555555

  • WHEN alice sends INVITE +15555555555
  • THEN bob receives an invite code and accepting/declining behaves as described in #99 (closed)

with vouch level > 1

GIVEN subscribers alice and bob on a channel with VOUCHING ON and VOUCH LEVEL 2 and a user cassie with phone number +15555555555

  • WHEN alice sends INVITE +15555555555

  • THEN alice receives a response saying Invitation issued.

  • AND THEN cassie recives a message that says You have received 1/2 invites needed to join the channel <CHANNEL_NAME>

  • WHEN bob sends INVITE +15555555555

  • THEN bob receives a response saying Invitation issued.

  • AND THEN cassie recives a message that says You have received 2/2 invites needed to join the channel <CHANNEL_NAME>. Please respond with ACCEPT or DECLINE.

    • IF cassie responds ACCEPT
      • THEN cassie receives a welcome message that says Hi! You are now subscribed to the [${channel.name}] Signalboost channel. Reply with HELP to learn more or GOODBYE to unsubscribe.
      • AND THEN alice and bob receive a notification that says Your invitation was accepted.
    • IF cassie responds DECLINE they are not added to the channel

Implementation

  • add following vouchLevel (number -> default 1) field to channels table
  • every time an invite record is created, app checks invites table and channel.vouchThreshold to see if invitee has received more than the threshold number of invites
    • if yes, message is sent
    • if not, just create the record and keep counting
  • notification and record deletion handled as in #99 (closed), only with more records per invitee!
Edited by aguestuser