Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2024-11-02 03:18:08 +00:00
parent 172cb5137f
commit 2b72943dc5
2 changed files with 2 additions and 6 deletions

View File

@ -282,10 +282,6 @@ module Gitlab
def ml_model_file_name_regex
@ml_model_file_name_regex ||= %r{\A[A-Za-z0-9\.\_\-\+ ]+\z}
end
def vs_code_user_agent_regex
/\Avs-code-gitlab-workflow/
end
end
end

View File

@ -4,11 +4,11 @@ module Gitlab
module UsageDataCounters
module VSCodeExtensionActivityUniqueCounter
VS_CODE_API_REQUEST_ACTION = 'i_code_review_user_vs_code_api_request'
VS_CODE_USER_AGENT_REGEX = /\Avs-code-gitlab-workflow/
class << self
def track_api_request_when_trackable(user_agent:, user:)
user_agent&.match?(Gitlab::Regex.vs_code_user_agent_regex) && track_unique_action_by_user(
VS_CODE_API_REQUEST_ACTION, user)
user_agent&.match?(VS_CODE_USER_AGENT_REGEX) && track_unique_action_by_user(VS_CODE_API_REQUEST_ACTION, user)
end
private