ChatOps calls should record user activity
What does this MR do and why?
ChatOps calls should record user activity as per #413368 (closed)
This MR triggers the user activity service at the same time as updating
the usage timestamp on the ChatName
record. There were some
suggestions1 about where to place this call, but I selected the
FindUserService
for the following reasons:
- It makes sense to me to mark activity on the ChatName and the user in the same place.
- Rubocop was nudging me away from calling a service from a model, and the service -> service call satisfies the code re-use guidelines2.
Changelog: fixed
How to set up and validate locally
-
Create a chat name for a user that has no recent activity in GDK's Rails console:
user = User.first user.chat_names.create(chat_id: 1, team_id: 1)
-
Set up a Slack command integration in one of your projects and copy the hook URL.
-
In your terminal:
curl --request POST --header "PRIVATE-TOKEN: <your-pat-here>" \ --url "http://localhost:3000/api/v4/projects/7/integrations/slack_slash_commands/trigger?token=<your-token>&team_id=1&user_id=1"
-
Verify that
User#last_activity_on
has been updated.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by James Nutt