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
33694a5a
Commit
33694a5a
authored
Aug 02, 2016
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use gitlab global root url as canonical base url for all javascript set cookies (closes #20435)
parent
6fb46b60
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
15 deletions
+39
-15
CHANGELOG
CHANGELOG
+1
-0
app/assets/javascripts/activities.js
app/assets/javascripts/activities.js
+1
-1
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+2
-2
app/assets/javascripts/awards_handler.js
app/assets/javascripts/awards_handler.js
+1
-0
app/assets/javascripts/project.js
app/assets/javascripts/project.js
+2
-6
app/assets/javascripts/right_sidebar.js
app/assets/javascripts/right_sidebar.js
+1
-1
app/assets/javascripts/user.js
app/assets/javascripts/user.js
+1
-3
spec/javascripts/awards_handler_spec.js
spec/javascripts/awards_handler_spec.js
+30
-2
No files found.
CHANGELOG
View file @
33694a5a
...
@@ -4,6 +4,7 @@ v 8.12.0 (unreleased)
...
@@ -4,6 +4,7 @@ v 8.12.0 (unreleased)
- Add two-factor recovery endpoint to internal API !5510
- Add two-factor recovery endpoint to internal API !5510
- Change merge_error column from string to text type
- Change merge_error column from string to text type
- Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel)
- Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel)
- Set path for all JavaScript cookies to honor GitLab's subdirectory setting !5627 (Mike Greiling)
- Optimistic locking for Issues and Merge Requests (title and description overriding prevention)
- Optimistic locking for Issues and Merge Requests (title and description overriding prevention)
- Add `wiki_page_events` to project hook APIs (Ben Boeckel)
- Add `wiki_page_events` to project hook APIs (Ben Boeckel)
- Add Sentry logging to API calls
- Add Sentry logging to API calls
...
...
app/assets/javascripts/activities.js
View file @
33694a5a
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
event_filters
=
$
.
cookie
(
"
event_filter
"
);
event_filters
=
$
.
cookie
(
"
event_filter
"
);
filter
=
sender
.
attr
(
"
id
"
).
split
(
"
_
"
)[
0
];
filter
=
sender
.
attr
(
"
id
"
).
split
(
"
_
"
)[
0
];
$
.
cookie
(
"
event_filter
"
,
(
event_filters
!==
filter
?
filter
:
""
),
{
$
.
cookie
(
"
event_filter
"
,
(
event_filters
!==
filter
?
filter
:
""
),
{
path
:
'
/
'
path
:
gon
.
relative_url_root
||
'
/
'
});
});
if
(
event_filters
!==
filter
)
{
if
(
event_filters
!==
filter
)
{
return
sender
.
closest
(
'
li
'
).
toggleClass
(
"
active
"
);
return
sender
.
closest
(
'
li
'
).
toggleClass
(
"
active
"
);
...
...
app/assets/javascripts/application.js
View file @
33694a5a
...
@@ -288,7 +288,7 @@
...
@@ -288,7 +288,7 @@
new
Aside
();
new
Aside
();
if
(
$window
.
width
()
<
1024
&&
$
.
cookie
(
'
pin_nav
'
)
===
'
true
'
)
{
if
(
$window
.
width
()
<
1024
&&
$
.
cookie
(
'
pin_nav
'
)
===
'
true
'
)
{
$
.
cookie
(
'
pin_nav
'
,
'
false
'
,
{
$
.
cookie
(
'
pin_nav
'
,
'
false
'
,
{
path
:
'
/
'
,
path
:
gon
.
relative_url_root
||
'
/
'
,
expires
:
365
*
10
expires
:
365
*
10
});
});
$
(
'
.page-with-sidebar
'
).
toggleClass
(
'
page-sidebar-collapsed page-sidebar-expanded
'
).
removeClass
(
'
page-sidebar-pinned
'
);
$
(
'
.page-with-sidebar
'
).
toggleClass
(
'
page-sidebar-collapsed page-sidebar-expanded
'
).
removeClass
(
'
page-sidebar-pinned
'
);
...
@@ -313,7 +313,7 @@
...
@@ -313,7 +313,7 @@
$topNav
.
removeClass
(
'
header-pinned-nav
'
).
toggleClass
(
'
header-collapsed header-expanded
'
);
$topNav
.
removeClass
(
'
header-pinned-nav
'
).
toggleClass
(
'
header-collapsed header-expanded
'
);
}
}
$
.
cookie
(
'
pin_nav
'
,
doPinNav
,
{
$
.
cookie
(
'
pin_nav
'
,
doPinNav
,
{
path
:
'
/
'
,
path
:
gon
.
relative_url_root
||
'
/
'
,
expires
:
365
*
10
expires
:
365
*
10
});
});
if
(
$
.
cookie
(
'
pin_nav
'
)
===
'
true
'
||
doPinNav
)
{
if
(
$
.
cookie
(
'
pin_nav
'
)
===
'
true
'
||
doPinNav
)
{
...
...
app/assets/javascripts/awards_handler.js
View file @
33694a5a
...
@@ -320,6 +320,7 @@
...
@@ -320,6 +320,7 @@
frequentlyUsedEmojis
=
this
.
getFrequentlyUsedEmojis
();
frequentlyUsedEmojis
=
this
.
getFrequentlyUsedEmojis
();
frequentlyUsedEmojis
.
push
(
emoji
);
frequentlyUsedEmojis
.
push
(
emoji
);
return
$
.
cookie
(
'
frequently_used_emojis
'
,
frequentlyUsedEmojis
.
join
(
'
,
'
),
{
return
$
.
cookie
(
'
frequently_used_emojis
'
,
frequentlyUsedEmojis
.
join
(
'
,
'
),
{
path
:
gon
.
relative_url_root
||
'
/
'
,
expires
:
365
expires
:
365
});
});
};
};
...
...
app/assets/javascripts/project.js
View file @
33694a5a
...
@@ -17,19 +17,15 @@
...
@@ -17,19 +17,15 @@
return
$
(
this
).
parents
(
'
form
'
).
submit
();
return
$
(
this
).
parents
(
'
form
'
).
submit
();
});
});
$
(
'
.hide-no-ssh-message
'
).
on
(
'
click
'
,
function
(
e
)
{
$
(
'
.hide-no-ssh-message
'
).
on
(
'
click
'
,
function
(
e
)
{
var
path
;
path
=
'
/
'
;
$
.
cookie
(
'
hide_no_ssh_message
'
,
'
false
'
,
{
$
.
cookie
(
'
hide_no_ssh_message
'
,
'
false
'
,
{
path
:
path
path
:
gon
.
relative_url_root
||
'
/
'
});
});
$
(
this
).
parents
(
'
.no-ssh-key-message
'
).
remove
();
$
(
this
).
parents
(
'
.no-ssh-key-message
'
).
remove
();
return
e
.
preventDefault
();
return
e
.
preventDefault
();
});
});
$
(
'
.hide-no-password-message
'
).
on
(
'
click
'
,
function
(
e
)
{
$
(
'
.hide-no-password-message
'
).
on
(
'
click
'
,
function
(
e
)
{
var
path
;
path
=
'
/
'
;
$
.
cookie
(
'
hide_no_password_message
'
,
'
false
'
,
{
$
.
cookie
(
'
hide_no_password_message
'
,
'
false
'
,
{
path
:
path
path
:
gon
.
relative_url_root
||
'
/
'
});
});
$
(
this
).
parents
(
'
.no-password-message
'
).
remove
();
$
(
this
).
parents
(
'
.no-password-message
'
).
remove
();
return
e
.
preventDefault
();
return
e
.
preventDefault
();
...
...
app/assets/javascripts/right_sidebar.js
View file @
33694a5a
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
}
}
if
(
!
triggered
)
{
if
(
!
triggered
)
{
return
$
.
cookie
(
"
collapsed_gutter
"
,
$
(
'
.right-sidebar
'
).
hasClass
(
'
right-sidebar-collapsed
'
),
{
return
$
.
cookie
(
"
collapsed_gutter
"
,
$
(
'
.right-sidebar
'
).
hasClass
(
'
right-sidebar-collapsed
'
),
{
path
:
'
/
'
path
:
gon
.
relative_url_root
||
'
/
'
});
});
}
}
});
});
...
...
app/assets/javascripts/user.js
View file @
33694a5a
...
@@ -7,10 +7,8 @@
...
@@ -7,10 +7,8 @@
});
});
this
.
initTabs
();
this
.
initTabs
();
$
(
'
.hide-project-limit-message
'
).
on
(
'
click
'
,
function
(
e
)
{
$
(
'
.hide-project-limit-message
'
).
on
(
'
click
'
,
function
(
e
)
{
var
path
;
path
=
'
/
'
;
$
.
cookie
(
'
hide_project_limit_message
'
,
'
false
'
,
{
$
.
cookie
(
'
hide_project_limit_message
'
,
'
false
'
,
{
path
:
path
path
:
gon
.
relative_url_root
||
'
/
'
});
});
$
(
this
).
parents
(
'
.project-limit-message
'
).
remove
();
$
(
this
).
parents
(
'
.project-limit-message
'
).
remove
();
return
e
.
preventDefault
();
return
e
.
preventDefault
();
...
...
spec/javascripts/awards_handler_spec.js
View file @
33694a5a
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
/*= require ./fixtures/emoji_menu */
/*= require ./fixtures/emoji_menu */
(
function
()
{
(
function
()
{
var
awardsHandler
,
lazyAssert
;
var
awardsHandler
,
lazyAssert
,
urlRoot
;
awardsHandler
=
null
;
awardsHandler
=
null
;
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
};
};
gon
.
award_menu_url
=
'
/emojis
'
;
gon
.
award_menu_url
=
'
/emojis
'
;
urlRoot
=
gon
.
relative_url_root
;
lazyAssert
=
function
(
done
,
assertFn
)
{
lazyAssert
=
function
(
done
,
assertFn
)
{
return
setTimeout
(
function
()
{
return
setTimeout
(
function
()
{
...
@@ -45,9 +46,14 @@
...
@@ -45,9 +46,14 @@
return
cb
();
return
cb
();
};
};
})(
this
));
})(
this
));
return
spyOn
(
jQuery
,
'
get
'
).
and
.
callFake
(
function
(
req
,
cb
)
{
spyOn
(
jQuery
,
'
get
'
).
and
.
callFake
(
function
(
req
,
cb
)
{
return
cb
(
window
.
emojiMenu
);
return
cb
(
window
.
emojiMenu
);
});
});
spyOn
(
jQuery
,
'
cookie
'
);
});
afterEach
(
function
()
{
// restore original url root value
gon
.
relative_url_root
=
urlRoot
;
});
});
describe
(
'
::showEmojiMenu
'
,
function
()
{
describe
(
'
::showEmojiMenu
'
,
function
()
{
it
(
'
should show emoji menu when Add emoji button clicked
'
,
function
(
done
)
{
it
(
'
should show emoji menu when Add emoji button clicked
'
,
function
(
done
)
{
...
@@ -189,6 +195,28 @@
...
@@ -189,6 +195,28 @@
return
expect
(
$thumbsUpEmoji
.
data
(
"
original-title
"
)).
toBe
(
'
sam
'
);
return
expect
(
$thumbsUpEmoji
.
data
(
"
original-title
"
)).
toBe
(
'
sam
'
);
});
});
});
});
describe
(
'
::addEmojiToFrequentlyUsedList
'
,
function
()
{
it
(
'
should set a cookie with the correct default path
'
,
function
()
{
gon
.
relative_url_root
=
''
;
awardsHandler
.
addEmojiToFrequentlyUsedList
(
'
sunglasses
'
);
expect
(
jQuery
.
cookie
)
.
toHaveBeenCalledWith
(
'
frequently_used_emojis
'
,
'
sunglasses
'
,
{
path
:
'
/
'
,
expires
:
365
})
;
});
it
(
'
should set a cookie with the correct custom root path
'
,
function
()
{
gon
.
relative_url_root
=
'
/gitlab/subdir
'
;
awardsHandler
.
addEmojiToFrequentlyUsedList
(
'
alien
'
);
expect
(
jQuery
.
cookie
)
.
toHaveBeenCalledWith
(
'
frequently_used_emojis
'
,
'
alien
'
,
{
path
:
'
/gitlab/subdir
'
,
expires
:
365
})
;
});
});
describe
(
'
search
'
,
function
()
{
describe
(
'
search
'
,
function
()
{
return
it
(
'
should filter the emoji
'
,
function
()
{
return
it
(
'
should filter the emoji
'
,
function
()
{
$
(
'
.js-add-award
'
).
eq
(
0
).
click
();
$
(
'
.js-add-award
'
).
eq
(
0
).
click
();
...
...
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