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
87052128
Commit
87052128
authored
Jan 09, 2018
by
Clement Ho
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into ee-dispatcher-dashboard-projects
parents
2f642c3c
0fa15a51
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
10 deletions
+27
-10
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+3
-3
app/assets/javascripts/pages/dashboard/todos/index/index.js
app/assets/javascripts/pages/dashboard/todos/index/index.js
+3
-0
app/assets/javascripts/pages/dashboard/todos/index/todos.js
app/assets/javascripts/pages/dashboard/todos/index/todos.js
+3
-3
changelogs/unreleased-ee/sh-strong-memoize-validate-path-locks.yml
...s/unreleased-ee/sh-strong-memoize-validate-path-locks.yml
+5
-0
lib/gitlab/checks/change_access.rb
lib/gitlab/checks/change_access.rb
+6
-3
spec/javascripts/todos_spec.js
spec/javascripts/todos_spec.js
+1
-1
spec/lib/gitlab/checks/change_access_spec.rb
spec/lib/gitlab/checks/change_access_spec.rb
+6
-0
No files found.
app/assets/javascripts/dispatcher.js
View file @
87052128
...
@@ -57,7 +57,6 @@ import GfmAutoComplete from './gfm_auto_complete';
...
@@ -57,7 +57,6 @@ import GfmAutoComplete from './gfm_auto_complete';
import
ShortcutsBlob
from
'
./shortcuts_blob
'
;
import
ShortcutsBlob
from
'
./shortcuts_blob
'
;
import
SigninTabsMemoizer
from
'
./signin_tabs_memoizer
'
;
import
SigninTabsMemoizer
from
'
./signin_tabs_memoizer
'
;
import
Star
from
'
./star
'
;
import
Star
from
'
./star
'
;
import
Todos
from
'
./todos
'
;
import
TreeView
from
'
./tree
'
;
import
TreeView
from
'
./tree
'
;
import
UsagePing
from
'
./usage_ping
'
;
import
UsagePing
from
'
./usage_ping
'
;
import
UsernameValidator
from
'
./username_validator
'
;
import
UsernameValidator
from
'
./username_validator
'
;
...
@@ -123,6 +122,7 @@ import initLDAPGroupsSelect from 'ee/ldap_groups_select'; // eslint-disable-line
...
@@ -123,6 +122,7 @@ import initLDAPGroupsSelect from 'ee/ldap_groups_select'; // eslint-disable-line
}
}
const
fail
=
()
=>
Flash
(
'
Error loading dynamic module
'
);
const
fail
=
()
=>
Flash
(
'
Error loading dynamic module
'
);
const
callDefault
=
m
=>
m
.
default
();
path
=
page
.
split
(
'
:
'
);
path
=
page
.
split
(
'
:
'
);
shortcut_handler
=
null
;
shortcut_handler
=
null
;
...
@@ -240,7 +240,7 @@ import initLDAPGroupsSelect from 'ee/ldap_groups_select'; // eslint-disable-line
...
@@ -240,7 +240,7 @@ import initLDAPGroupsSelect from 'ee/ldap_groups_select'; // eslint-disable-line
projectSelect
();
projectSelect
();
break
;
break
;
case
'
dashboard:todos:index
'
:
case
'
dashboard:todos:index
'
:
new
Todos
(
);
import
(
'
./pages/dashboard/todos/index
'
).
then
(
callDefault
).
catch
(
fail
);
break
;
break
;
case
'
dashboard:projects:index
'
:
case
'
dashboard:projects:index
'
:
case
'
dashboard:projects:starred
'
:
case
'
dashboard:projects:starred
'
:
...
@@ -609,7 +609,7 @@ import initLDAPGroupsSelect from 'ee/ldap_groups_select'; // eslint-disable-line
...
@@ -609,7 +609,7 @@ import initLDAPGroupsSelect from 'ee/ldap_groups_select'; // eslint-disable-line
new
CILintEditor
();
new
CILintEditor
();
break
;
break
;
case
'
users:show
'
:
case
'
users:show
'
:
import
(
'
./pages/users/show
'
).
then
(
m
=>
m
.
default
()
).
catch
(
fail
);
import
(
'
./pages/users/show
'
).
then
(
callDefault
).
catch
(
fail
);
break
;
break
;
case
'
admin:conversational_development_index:show
'
:
case
'
admin:conversational_development_index:show
'
:
new
UserCallout
();
new
UserCallout
();
...
...
app/assets/javascripts/pages/dashboard/todos/index/index.js
0 → 100644
View file @
87052128
import
Todos
from
'
./todos
'
;
export
default
()
=>
new
Todos
();
app/assets/javascripts/todos.js
→
app/assets/javascripts/
pages/dashboard/todos/index/
todos.js
View file @
87052128
/* eslint-disable class-methods-use-this, no-unneeded-ternary, quote-props */
/* eslint-disable class-methods-use-this, no-unneeded-ternary, quote-props */
import
{
visitUrl
}
from
'
.
/lib/utils/url_utility
'
;
import
{
visitUrl
}
from
'
~
/lib/utils/url_utility
'
;
import
UsersSelect
from
'
.
/users_select
'
;
import
UsersSelect
from
'
~
/users_select
'
;
import
{
isMetaClick
}
from
'
.
/lib/utils/common_utils
'
;
import
{
isMetaClick
}
from
'
~
/lib/utils/common_utils
'
;
export
default
class
Todos
{
export
default
class
Todos
{
constructor
()
{
constructor
()
{
...
...
changelogs/unreleased-ee/sh-strong-memoize-validate-path-locks.yml
0 → 100644
View file @
87052128
---
title
:
Properly memoize ChangeAccess#validate_path_locks? to avoid excessive queries
merge_request
:
author
:
type
:
performance
lib/gitlab/checks/change_access.rb
View file @
87052128
...
@@ -2,6 +2,7 @@ module Gitlab
...
@@ -2,6 +2,7 @@ module Gitlab
module
Checks
module
Checks
class
ChangeAccess
class
ChangeAccess
include
PathLocksHelper
include
PathLocksHelper
include
Gitlab
::
Utils
::
StrongMemoize
ERROR_MESSAGES
=
{
ERROR_MESSAGES
=
{
push_code:
'You are not allowed to push code to this project.'
,
push_code:
'You are not allowed to push code to this project.'
,
...
@@ -300,10 +301,12 @@ module Gitlab
...
@@ -300,10 +301,12 @@ module Gitlab
end
end
def
validate_path_locks?
def
validate_path_locks?
@validate_path_locks
||=
@project
.
feature_available?
(
:file_locks
)
&&
strong_memoize
(
:validate_path_locks
)
do
@project
.
feature_available?
(
:file_locks
)
&&
project
.
path_locks
.
any?
&&
@newrev
&&
@oldrev
&&
project
.
path_locks
.
any?
&&
@newrev
&&
@oldrev
&&
project
.
default_branch
==
@branch_name
# locks protect default branch only
project
.
default_branch
==
@branch_name
# locks protect default branch only
end
end
end
def
path_locks_validation
def
path_locks_validation
lambda
do
|
diff
|
lambda
do
|
diff
|
...
...
spec/javascripts/todos_spec.js
View file @
87052128
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
Todos
from
'
~/todos
'
;
import
Todos
from
'
~/
pages/dashboard/todos/index/
todos
'
;
import
'
~/lib/utils/common_utils
'
;
import
'
~/lib/utils/common_utils
'
;
describe
(
'
Todos
'
,
()
=>
{
describe
(
'
Todos
'
,
()
=>
{
...
...
spec/lib/gitlab/checks/change_access_spec.rb
View file @
87052128
...
@@ -319,6 +319,12 @@ describe Gitlab::Checks::ChangeAccess do
...
@@ -319,6 +319,12 @@ describe Gitlab::Checks::ChangeAccess do
it
'allows the default branch even if it does not match push rule'
do
it
'allows the default branch even if it does not match push rule'
do
expect
{
subject
.
exec
}.
not_to
raise_error
expect
{
subject
.
exec
}.
not_to
raise_error
end
end
it
'memoizes the validate_path_locks? call'
do
expect
(
project
.
path_locks
).
to
receive
(
:any?
).
once
.
and_call_original
2
.
times
{
subject
.
exec
}
end
end
end
end
end
...
...
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