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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-07-06 15:06:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-07-06 15:06:46 +0300
commit30acb0522a609c438d60f5345243e96f9a041ae6 (patch)
treece1b11d55c510996e3ebe9a5e96db5fd08dbeaf2 /lib/api/helpers.rb
parentd2485dbfedc4759eba5243e0d155e34494c4429b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index df080c8e666..b616f1b35b3 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -657,6 +657,19 @@ module API
Gitlab::AppLogger.warn("Redis tracking event failed for event: #{event_name}, message: #{error.message}")
end
+ def track_event(event_name, user_id:, namespace_id: nil, project_id: nil)
+ return unless user_id.present?
+
+ Gitlab::InternalEvents.track_event(
+ event_name,
+ user_id: user_id,
+ namespace_id: namespace_id,
+ project_id: project_id
+ )
+ rescue StandardError => error
+ Gitlab::AppLogger.warn("Internal Event tracking event failed for event: #{event_name}, message: #{error.message}")
+ end
+
def order_by_similarity?(allow_unauthorized: true)
params[:order_by] == 'similarity' && params[:search].present? && (allow_unauthorized || current_user.present?)
end