decode tag name before passing it into TagFollowingAction, fixes #4027
This commit is contained in:
parent
f8513c2005
commit
60bd29aa68
3 changed files with 21 additions and 1 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
* Delegate parent_author to the target of a RelayableRetraction
|
* Delegate parent_author to the target of a RelayableRetraction
|
||||||
* Do not fail on receiving a SignedRetraction via the public route
|
* Do not fail on receiving a SignedRetraction via the public route
|
||||||
* Pass the real values to stderr_path and stdout_path in unicorn.rb since it runs a case statement on them.
|
* Pass the real values to stderr_path and stdout_path in unicorn.rb since it runs a case statement on them.
|
||||||
|
* Decode tag name before passing it into a TagFollowingAction [#4027](https://github.com/diaspora/diaspora/issues/4027)
|
||||||
|
|
||||||
## Refactor
|
## Refactor
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ app.Router = Backbone.Router.extend({
|
||||||
|
|
||||||
if(name) {
|
if(name) {
|
||||||
var followedTagsAction = new app.views.TagFollowingAction(
|
var followedTagsAction = new app.views.TagFollowingAction(
|
||||||
{tagText: name}
|
{tagText: decodeURIComponent(name)}
|
||||||
);
|
);
|
||||||
$("#author_info").prepend(followedTagsAction.render().el)
|
$("#author_info").prepend(followedTagsAction.render().el)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
spec/javascripts/app/router_spec.js
Normal file
19
spec/javascripts/app/router_spec.js
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
describe('app.Router', function () {
|
||||||
|
describe('followed_tags', function() {
|
||||||
|
it('decodes name before passing it into TagFollowingAction', function () {
|
||||||
|
var followed_tags = spyOn(app.router, 'followed_tags').andCallThrough();
|
||||||
|
var tag_following_action = spyOn(app.views, 'TagFollowingAction').andCallFake(function(data) {
|
||||||
|
return {render: function() { return {el: ""}}};
|
||||||
|
});
|
||||||
|
spyOn(window.history, 'pushState').andCallFake(function (data, title, url) {
|
||||||
|
var route = app.router._routeToRegExp("tags/:name");
|
||||||
|
var args = app.router._extractParameters(route, url.replace(/^\//, ""));
|
||||||
|
app.router.followed_tags(args[0]);
|
||||||
|
});
|
||||||
|
window.preloads = {tagFollowings: []};
|
||||||
|
app.router.navigate('/tags/'+encodeURIComponent('օբյեկտիվ'));
|
||||||
|
expect(followed_tags).toHaveBeenCalled();
|
||||||
|
expect(tag_following_action).toHaveBeenCalledWith({tagText: 'օբյեկտիվ'});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue