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
d8153263
Commit
d8153263
authored
Jun 05, 2020
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add preconnect tag for Snowplow
Closes
https://gitlab.com/gitlab-org/gitlab/-/issues/220499
parent
d59c77bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
app/views/layouts/_head.html.haml
app/views/layouts/_head.html.haml
+3
-0
spec/views/layouts/_head.html.haml_spec.rb
spec/views/layouts/_head.html.haml_spec.rb
+9
-2
No files found.
app/views/layouts/_head.html.haml
View file @
d8153263
...
...
@@ -20,6 +20,9 @@
%link
{
rel:
'dns-prefetch'
,
href:
ActionController
::
Base
.
asset_host
}
%link
{
rel:
'preconnect'
,
href:
ActionController
::
Base
.
asset_host
,
crossorigin:
''
}
-
if
Gitlab
::
CurrentSettings
.
snowplow_enabled?
&&
Gitlab
::
CurrentSettings
.
snowplow_collector_hostname
%link
{
rel:
'preconnect'
,
href:
Gitlab
::
CurrentSettings
.
snowplow_collector_hostname
,
crossorigin:
''
}
%meta
{
'http-equiv'
=>
'X-UA-Compatible'
,
content:
'IE=edge'
}
-# Open Graph - http://ogp.me/
...
...
spec/views/layouts/_head.html.haml_spec.rb
View file @
d8153263
...
...
@@ -64,18 +64,25 @@ describe 'layouts/_head' do
context
'when an asset_host is set and snowplow url is set'
do
let
(
:asset_host
)
{
'http://test.host'
}
let
(
:snowplow_collector_hostname
)
{
'www.snow.plow'
}
before
do
allow
(
ActionController
::
Base
).
to
receive
(
:asset_host
).
and_return
(
asset_host
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:snowplow_enabled?
).
and_return
(
true
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:snowplow_collector_hostname
).
and_return
(
'www.snow.plow'
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:snowplow_collector_hostname
).
and_return
(
snowplow_collector_hostname
)
end
it
'adds a snowplow script tag with asset host'
do
render
expect
(
rendered
).
to
match
(
'http://test.host/assets/snowplow/'
)
expect
(
rendered
).
to
match
(
'window.snowplow'
)
expect
(
rendered
).
to
match
(
'www.snow.plow'
)
expect
(
rendered
).
to
match
(
snowplow_collector_hostname
)
end
it
'adds a link preconnect tag'
do
render
expect
(
rendered
).
to
match
(
%Q(<link crossorigin="" href="
#{
snowplow_collector_hostname
}
" rel="preconnect">)
)
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