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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
368e9a08
Commit
368e9a08
authored
Feb 02, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rubocop: Style/CaseIndentation enabled
parent
da884aab
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
18 deletions
+16
-18
.rubocop.yml
.rubocop.yml
+1
-1
app/finders/notes_finder.rb
app/finders/notes_finder.rb
+13
-12
lib/api/api_guard.rb
lib/api/api_guard.rb
+2
-5
No files found.
.rubocop.yml
View file @
368e9a08
...
@@ -96,7 +96,7 @@ Style/CaseEquality:
...
@@ -96,7 +96,7 @@ Style/CaseEquality:
Style/CaseIndentation
:
Style/CaseIndentation
:
Description
:
'
Indentation
of
when
in
a
case/when/[else/]end.'
Description
:
'
Indentation
of
when
in
a
case/when/[else/]end.'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#indent-when-to-case'
StyleGuide
:
'
https://github.com/bbatsov/ruby-style-guide#indent-when-to-case'
Enabled
:
fals
e
Enabled
:
tru
e
Style/CharacterLiteral
:
Style/CharacterLiteral
:
Description
:
'
Checks
for
uses
of
character
literals.'
Description
:
'
Checks
for
uses
of
character
literals.'
...
...
app/finders/notes_finder.rb
View file @
368e9a08
...
@@ -7,18 +7,19 @@ class NotesFinder
...
@@ -7,18 +7,19 @@ class NotesFinder
# Default to 0 to remain compatible with old clients
# Default to 0 to remain compatible with old clients
last_fetched_at
=
Time
.
at
(
params
.
fetch
(
:last_fetched_at
,
0
).
to_i
)
last_fetched_at
=
Time
.
at
(
params
.
fetch
(
:last_fetched_at
,
0
).
to_i
)
notes
=
case
target_type
notes
=
when
"commit"
case
target_type
project
.
notes
.
for_commit_id
(
target_id
).
not_inline
.
fresh
when
"commit"
when
"issue"
project
.
notes
.
for_commit_id
(
target_id
).
not_inline
.
fresh
project
.
issues
.
find
(
target_id
).
notes
.
inc_author
.
fresh
when
"issue"
when
"merge_request"
project
.
issues
.
find
(
target_id
).
notes
.
inc_author
.
fresh
project
.
merge_requests
.
find
(
target_id
).
mr_and_commit_notes
.
inc_author
.
fresh
when
"merge_request"
when
"snippet"
,
"project_snippet"
project
.
merge_requests
.
find
(
target_id
).
mr_and_commit_notes
.
inc_author
.
fresh
project
.
snippets
.
find
(
target_id
).
notes
.
fresh
when
"snippet"
,
"project_snippet"
else
project
.
snippets
.
find
(
target_id
).
notes
.
fresh
raise
'invalid target_type'
else
end
raise
'invalid target_type'
end
# Use overlapping intervals to avoid worrying about race conditions
# Use overlapping intervals to avoid worrying about race conditions
notes
.
where
(
'updated_at > ?'
,
last_fetched_at
-
FETCH_OVERLAP
)
notes
.
where
(
'updated_at > ?'
,
last_fetched_at
-
FETCH_OVERLAP
)
...
...
lib/api/api_guard.rb
View file @
368e9a08
...
@@ -47,16 +47,12 @@ module APIGuard
...
@@ -47,16 +47,12 @@ module APIGuard
case
validate_access_token
(
access_token
,
scopes
)
case
validate_access_token
(
access_token
,
scopes
)
when
Oauth2
::
AccessTokenValidationService
::
INSUFFICIENT_SCOPE
when
Oauth2
::
AccessTokenValidationService
::
INSUFFICIENT_SCOPE
raise
InsufficientScopeError
.
new
(
scopes
)
raise
InsufficientScopeError
.
new
(
scopes
)
when
Oauth2
::
AccessTokenValidationService
::
EXPIRED
when
Oauth2
::
AccessTokenValidationService
::
EXPIRED
raise
ExpiredError
raise
ExpiredError
when
Oauth2
::
AccessTokenValidationService
::
REVOKED
when
Oauth2
::
AccessTokenValidationService
::
REVOKED
raise
RevokedError
raise
RevokedError
when
Oauth2
::
AccessTokenValidationService
::
VALID
when
Oauth2
::
AccessTokenValidationService
::
VALID
@current_user
=
User
.
find
(
access_token
.
resource_owner_id
)
@current_user
=
User
.
find
(
access_token
.
resource_owner_id
)
end
end
end
end
end
end
...
@@ -121,7 +117,8 @@ module APIGuard
...
@@ -121,7 +117,8 @@ module APIGuard
def
oauth2_bearer_token_error_handler
def
oauth2_bearer_token_error_handler
Proc
.
new
do
|
e
|
Proc
.
new
do
|
e
|
response
=
case
e
response
=
case
e
when
MissingTokenError
when
MissingTokenError
Rack
::
OAuth2
::
Server
::
Resource
::
Bearer
::
Unauthorized
.
new
Rack
::
OAuth2
::
Server
::
Resource
::
Bearer
::
Unauthorized
.
new
...
...
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