Merge pull request #4029 from MrZYX/4027-unicode-tags

decode tag name before passing it into TagFollowingAction
This commit is contained in:
Florian Staudacher 2013-03-11 05:51:54 -07:00
commit 0de68fb713
3 changed files with 21 additions and 1 deletions

View file

@ -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

View file

@ -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)
} }

View 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: 'օբյեկտիվ'});
});
});
});