Skip to content

[#185] Resolve "Bug: hotline messages counted as broadcast mesages"

Closes #185 (closed)

Context

  • We currently count incoming hotline messages as broadcast messages, which is bad because it skews our "broadcastOut" numbers a lot (by multiplying every hotline message by number of subscribers instead of number of admins, so it looks like a lot more broadcast messages went out than actually did)
  • Plus it would be nice to have visibility into how many incoming hotline messages v. outgoing broadcast messages are happening overall to develop a better intuition for how people use the app

Changes

  • create new messageCount fields for hotlineIn / hotlineOut
  • increment them appropriately after forwarding a hotline message
  • modify the response to boost list-channels to:
    • sort by number of subscribers, descending (instead of by broadcastOut, which is a dumb metric anyway!)
    • show broadcastIn, hotlineIn, and commandIn counts for each channel (don't show broadcastOut)
  • zero out all messageCounts for all channels and start fresh with clean (no-bug) counts

Implementation Notes

  • add hotline fields to messageCount table/model
  • extract all counting logic to repositories.messageCount (eliminate helpers from dispatcher.messenger)
  • add respositories.messageCount.countHotline and call it in messenger.relayHotlineMessage
    • lleanup tail end of relayHotlineMessage to avoid double counting an incoming hotline message as a command
  • modify repository.channel.findAllDeep to not sort by anything
  • modify registrar.channel._formatForList to show broadCastIn and hotlineIn and sort by subscribers
  • add a migration to set all messageCounts to zero and start fresh with clean data

Merge request reports