Commit 57efb2d6 authored by sfang97's avatar sfang97

Implicit return terms_accepted if project_bot

parent 1a5b744c
......@@ -14,6 +14,8 @@ class ApplicationSetting
end
def accepted_by_user?(user)
return true if user.bot?
user.accepted_term_id == id ||
term_agreements.accepted.where(user: user).exists?
end
......
......@@ -1674,6 +1674,8 @@ class User < ApplicationRecord
end
def terms_accepted?
return true if project_bot?
accepted_term_id.present?
end
......
......@@ -54,11 +54,6 @@ module API
user = find_user_from_sources
return unless user
if user.bot?
terms = Gitlab::CurrentSettings.current_application_settings.latest_terms
::Users::RespondToTermsService.new(user, terms).execute(accepted: true)
end
# Sessions are enforced to be unavailable for API calls, so ignore them for admin mode
Gitlab::Auth::CurrentUserMode.bypass_session!(user.id) if Feature.enabled?(:user_mode_in_session)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment