From d75cf96f25b6311786523fef048e33c593a1ba08 Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Tue, 8 Apr 2014 13:54:35 +0400 Subject: [PATCH] search valid usernames and hashtags --- js/twister_following.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/js/twister_following.js b/js/twister_following.js index 4fc54c2..5dc8d6a 100644 --- a/js/twister_following.js +++ b/js/twister_following.js @@ -367,12 +367,18 @@ function userSearchKeypress(item) { // Enter pressed var dummy = $(''); if (prefix == '#') { // hashtag - dummy.attr('href', $.MAL.hashtagUrl(partialName)); - dummy.text('#' + partialName); - openHashtagModal.call(dummy.get(0), item); + partialName = _extractHashtag(partialName); + if (partialName) { + dummy.attr('href', $.MAL.hashtagUrl(partialName)); + dummy.text('#' + partialName); + openHashtagModal.call(dummy.get(0), item); + } } else { // username - dummy.attr('href', $.MAL.userUrl(partialName)); - openProfileModal.call(dummy.get(0), item); + partialName = _extractUsername(partialName); + if (partialName) { + dummy.attr('href', $.MAL.userUrl(partialName)); + openProfileModal.call(dummy.get(0), item); + } } return false; }