From a5bb8f4e7d6b0d7529d2026b9e97b18dfdd12d7c Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 29 Mar 2018 00:47:14 -0400 Subject: [PATCH 1/2] Strip strtolower from Module\Hashtag --- src/Module/Hashtag.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index 82cfa1f84..c35a6440c 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -31,7 +31,7 @@ class Hashtag extends BaseModule intval(TERM_HASHTAG) ); while ($tag = dba::fetch($taglist)) { - $result[] = ['text' => strtolower($tag['term'])]; + $result[] = ['text' => $tag['term']]; } dba::close($taglist); From 84b4ff58b68da2ddbd716d4b54297447db6d1975 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 29 Mar 2018 00:47:27 -0400 Subject: [PATCH 2/2] Make Hashtag autocomplete case-insensitive --- view/js/autocomplete.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index eb9d5efbe..885c38d6d 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -220,7 +220,15 @@ function string2bb(element) { tags = { match: /(^|\s)(\#)([^ \n]{2,})$/, index: 3, - search: function(term, callback) { $.getJSON(baseurl + '/hashtag/' + '?f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); }, + search: function(term, callback) { + $.getJSON(baseurl + '/hashtag/' + '?f=&t=' + term) + .done(function(data) { + callback($.map(data, function(entry) { + // .toLowerCase() enables case-insensitive search + return entry.text.toLowerCase().indexOf(term.toLowerCase()) === 0 ? entry : null; + })); + }); + }, replace: function(item) { return "$1$2" + item.text + ' '; }, template: tag_format };