BUG: properly handle out-of-context no-payload commands
bug description
- SYMPTOM: when subscriber sends a hotline message that says "Hello i want to report an incident" they get a response that says "Sorry, that command was not recognized. Did you mean to use HELLO"?
- CAUSE:
parse.validateNoPayload
returns a parse error for all no-payload commands that are followed by a payload, meaning that what should be interpreted as a hotline message is handled as acommandResult
with statusERROR
once it hitsdispatcher.messenger.parseMessageType
(see: https://0xacab.org/team-friendo/signalboost/-/blob/main/app/dispatcher/messenger.js#L67-70), where to be interpreted as a hotline message it would have to have command typeNONE
and statusSUCCESS
(but it has command typeJOIN
and statusERROR
- FIX: TBD! probably add some logic to the
command.execute
layer that coerces the type of any such message toNONE
and its status toSUCCESS
(likely as an early-returningreturnIfHotline
that is called just above the switch statement inexecute#execute
, which checks to see if the sender is a subscriber and hotline messages are enabled and returns early with a coorced type/status if so. maybe group this with the other special casing parse error-handling logic we currently have above the switch statement)
desired behavior
GIVEN hotline messages enabled
- WHEN a subscriber sends
Hello everyone
orAccept the consequences
(or any other no-payload command, see below) - THEN the message should be treated like a hotline message and forwarded to admins
GIVEN hotline messages disabled
- WHEN a subscriber sens
Hello everyone
(or any sentence starting with a 1-word command) - THEN the message should trigger an error message:
- IF command is issuable by subscriber/rando (see below)
- THEN respond with current error message. ("did you mean to X?")
- IF the command is not issuable by a subscriber
- THEN respond with a generic "i don't understand, i didn't send that, use HELP" message
- TK-TODO: what is this "generic" error message?
- IF command is issuable by subscriber/rando (see below)
GIVEN hotline messages in any state
- WHEN an admin or rando sends
Hello everyone
it triggers the "no payload" error message above (potentially we should add "were you trying to send a broadcast message?" to error for admins?)
definitions
the set of "no payload commands" is:
subscriber:
ACCEPT
DECLINE
HELP
INFO
JOIN
LEAVE
SET_LANGUAGE
admin-only:
DESTROY
DESTROY_CONFIRM
HOTLINE_ON
HOTLINE_OFF
VOUCHING_ON
VOUCHING_OFF
VOUCHING_ADMIN
Edited by aguestuser