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
7cb47064
Commit
7cb47064
authored
Jun 24, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
857eb8dd
833013ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
app/helpers/appearances_helper.rb
app/helpers/appearances_helper.rb
+4
-1
changelogs/unreleased/sh-strong-memoize-appearances.yml
changelogs/unreleased/sh-strong-memoize-appearances.yml
+5
-0
spec/helpers/appearances_helper_spec.rb
spec/helpers/appearances_helper_spec.rb
+16
-0
No files found.
app/helpers/appearances_helper.rb
View file @
7cb47064
...
...
@@ -2,6 +2,7 @@
module
AppearancesHelper
include
MarkupHelper
include
Gitlab
::
Utils
::
StrongMemoize
def
brand_title
current_appearance
&
.
title
.
presence
||
default_brand_title
...
...
@@ -25,7 +26,9 @@ module AppearancesHelper
end
def
current_appearance
@appearance
||=
Appearance
.
current
strong_memoize
(
:current_appearance
)
do
Appearance
.
current
end
end
def
brand_header_logo
...
...
changelogs/unreleased/sh-strong-memoize-appearances.yml
0 → 100644
View file @
7cb47064
---
title
:
Memoize non-existent custom appearances
merge_request
:
29957
author
:
type
:
performance
spec/helpers/appearances_helper_spec.rb
View file @
7cb47064
...
...
@@ -8,6 +8,22 @@ describe AppearancesHelper do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
end
describe
'.current_appearance'
do
it
'memoizes empty appearance'
do
expect
(
Appearance
).
to
receive
(
:current
).
once
2
.
times
{
helper
.
current_appearance
}
end
it
'memoizes custom appearance'
do
create
(
:appearance
)
expect
(
Appearance
).
to
receive
(
:current
).
once
.
and_call_original
2
.
times
{
helper
.
current_appearance
}
end
end
describe
'#header_message'
do
it
'returns nil when header message field is not set'
do
create
(
:appearance
)
...
...
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