This commit centralizes 'display name' generation into a helper, and updates it to respect core preferences for `enable_names` and `prioritize_username_in_ux`.
We were using the internal UID of the channel in the hint, which would then fail to match any 'channel' configs in Discourse (which use the human-friendly `#channel` format). This was causing automatic threading for transcripts to fail.
This allows for the discourse automation plugin to have a "Send Slack
Message" script.
The script fields are a message, url, and slack channel. This will allow
for a custom slack message to be posted but can link back to an
arbitrary url (hopefully a discourse url) like a list of unanswered
topics instead of strictly only allowing a slack message that links back
to a Discourse Post object.
When notifications about a topic are posted to multiple slack channels, and the Discourse channels are configured to "thread" the notifications, each channel will have a different thread_id. Previously we were only storing a single slack thread id per Discourse topic. This commit fixes that logic, so that threads in different channels are tracked separately.