Google Chat - merge requests and issues from different projects are added to the same thread
Summary
Customer reproduced on 15.11.2-ee
When using the Google Chat integration and threads are enabled, merge requests from different projects that have the same ID are added to the same thread.
Steps to reproduce
Theoretically the steps to reproduce this would be:
- Enable the Google Chat integration in 2 projects in GitLab. When creating the room/space, ensure that threading is enabled.
- In each project, create a merge request with the same ID. The merge requests will go into the same thread instead of separate threads.
Do note I have been unable to reproduce this while the customer has been able to do so. In my Chat space, I do not have the option to enable threading.
Example Project
N/A
What is the current bug behavior?
Merge requests with the same ID are being added to the same thread in Google Chat.
What is the expected correct behavior?
Merge requests with the same ID should be added to separate threads in Google Chat.
Relevant logs and/or screenshots
See ZD for more information including screenshots and a video of the bug.
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
I think this is where we are calculating the thread ID for merge requests app/models/integrations/hangouts_chat.rb#L63. We are using the merge request IID in the thread ID which would explain why merge requests from different projects are being linked together.
It looks like the same issue would affect issues as well app/models/integrations/hangouts_chat.rb#L61.
Implementation guide
Mentioned #412391 (comment 1402479122):
It looks like we have a
project_name
attribute available to us when we make the threading key so we should add theproject_name
to the thread key for both merge requests and issues.