Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
57efb2d6
Commit
57efb2d6
authored
Sep 23, 2020
by
sfang97
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implicit return terms_accepted if project_bot
parent
1a5b744c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
5 deletions
+4
-5
app/models/application_setting/term.rb
app/models/application_setting/term.rb
+2
-0
app/models/user.rb
app/models/user.rb
+2
-0
lib/api/api_guard.rb
lib/api/api_guard.rb
+0
-5
No files found.
app/models/application_setting/term.rb
View file @
57efb2d6
...
...
@@ -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
...
...
app/models/user.rb
View file @
57efb2d6
...
...
@@ -1674,6 +1674,8 @@ class User < ApplicationRecord
end
def
terms_accepted?
return
true
if
project_bot?
accepted_term_id
.
present?
end
...
...
lib/api/api_guard.rb
View file @
57efb2d6
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment