Indicate who a Slack mention is from
Context
This is related to the Slack notifications for group @-mentions. It posts mentions to #sec-appsec-mentions in Slack.
We have a lot of things where someone from AppSec pings the AppSec team, and then we come into this channel and react with a :me: emoji to indicate that its not a ping from other stakeholders. This helps people on ping triage rotation prioritize requests to AppSec from other teams.
Desired Changes
Extend the Slack notifications to be configurable to have an obvious indication that the ping came from someone on the mentioned group.
Possible Solutions
For the AppSec team workflow, we use :security-tanuki:) when it was an AppSec team member who did the ping.
Alternatively and perhaps more universal for the product, the ping message itself could have a clear indicator that it was a self-mention. Even prepending something like (SELF MENTION) to the message might be satisfactory.
Proposal
Include the username of the user doing the mentioning.
- Pro: people in the Slack channel (e.g. AppSec team members) can see who did the mentioning.
- Con: It's not smartly identifying self-mentions. People in the Slack channel still need to map the username to a team member in their head (e.g. is
truegregtruly the Greg on the team?...🤔 ) - Con: It doesn't add emoji reactions to Slack messages
- Pro: It will be a very small change, both code-wise and user experience-wise
- Pro: No need to add templating, configuration options, etc. The UI for turning this feature on is pretty simple (a checkbox, and a comma-separated list of channels to post to)
Implementation plan
it 'returns the appropriate message' do
expect(subject.pretext).to eq(
'Group [test/group](http://test/group) was mentioned ' \
+++ 'by [Test User](http://test.user) ' \
'in [issue #42](http://issue) ' \
'of [Test Project](http://project): ' \
'*Test Issue*'
)
expect(subject.attachments).to eq("Issue\ndescription\n123")
expect(subject.activity).to eq(
{
--- title: 'Group [test/group](http://test/group) was mentioned in [issue #42](http://issue)',
+++ title: 'Group [test/group](http://test/group) was mentioned by [Test User](http://test.user) in [issue #42](http://issue)',
subtitle: 'of [Test Project](http://project)',
text: 'Test Issue',
image: 'http://avatar'
}
)
end
- Update the specs to include the username that did the mentioning (Test Driven Development styles ;) )
- https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/models/integrations/chat_message/group_mention_message_spec.rb
- There are six specs / six code variations to add the username to. Both
subject.pretextandsubject.activity > titleshould be updated. -
Notethe URL might need to be updated compared to the diff in the description above.
- Update the code to make the specs pass
-
Ship it
I used !96684 (diffs) to identify relevant files to this proposal.