Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 06:08:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 06:08:01 +0300
commit796b00a98a82fcbe082c9343fd4efcccc77478dc (patch)
tree257bcb124f57cb91a8dff75e69649e8a2f91c51d /app
parent93dcf45d441bc884b167f4338380c8c888e9b86f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 03b247f213b..93ac9b64a98 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -107,6 +107,7 @@ class Project < ApplicationRecord
after_update :update_forks_visibility_level
before_destroy :remove_private_deploy_keys
+ before_destroy :cleanup_chat_names
use_fast_destroy :build_trace_chunks
@@ -1908,6 +1909,17 @@ class Project < ApplicationRecord
import_export_upload&.export_file
end
+ # Before 12.9 we did not correctly clean up chat names and this causes issues.
+ # In 12.9, we add a foreign key relationship, but this code is used ensure the chat names are cleaned up while a post
+ # migration enables the foreign key relationship.
+ #
+ # This should be removed in 13.0.
+ #
+ # https://gitlab.com/gitlab-org/gitlab/issues/204787
+ def cleanup_chat_names
+ ChatName.where(service: services.select(:id)).delete_all
+ end
+
def full_path_slug
Gitlab::Utils.slugify(full_path.to_s)
end