From a454aad124f999e59e8bffb625c103b975aef107 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 7 Mar 2018 15:39:14 -0800 Subject: [PATCH 1/3] federated polls: GNU-Social requires us to preserve the original order of the poll answers for use in making a vote, unlike diaspora (which selects by guid) and activitypub (which selects by non-localisable text). --- Zotlabs/Update/_1209.php | 26 ++++++++++++++++++++++++++ boot.php | 2 +- install/schema_mysql.sql | 4 +++- install/schema_postgres.sql | 2 ++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 Zotlabs/Update/_1209.php diff --git a/Zotlabs/Update/_1209.php b/Zotlabs/Update/_1209.php new file mode 100644 index 000000000..5ec449395 --- /dev/null +++ b/Zotlabs/Update/_1209.php @@ -0,0 +1,26 @@ + Date: Wed, 7 Mar 2018 16:59:55 -0800 Subject: [PATCH 2/3] hashtag autocomplete --- Zotlabs/Module/Hashtags.php | 29 +++++++++++++++++++++++++++++ view/js/autocomplete.js | 16 +++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 Zotlabs/Module/Hashtags.php diff --git a/Zotlabs/Module/Hashtags.php b/Zotlabs/Module/Hashtags.php new file mode 100644 index 000000000..d87a82818 --- /dev/null +++ b/Zotlabs/Module/Hashtags.php @@ -0,0 +1,29 @@ + strtolower($rv['term']) ]; + } + } + logger(print_r($result,true)); + json_return_and_die($result); + } +} \ No newline at end of file diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 01def9900..2d017db18 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -74,6 +74,10 @@ function bbco_format(item) { return ""; } +function tag_format(item) { + return ""; +} + function editor_replace(item) { if(typeof item.replace !== 'undefined') { return '$1$2' + item.replace; @@ -202,6 +206,16 @@ function string2bb(element) { }; + // Autocomplete hashtags + tags = { + match: /(^|\s)(\#)([^ \n]{2,})$/, + index: 3, + search: function(term, callback) { $.getJSON('/hashtags/' + '$f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); }, + replace: function(item) { return "$1$2" + item.text + ' '; }, + template: tag_format + }; + + smilies = { match: /(^|\s)(:[a-z_:]{2,})$/, index: 2, @@ -211,7 +225,7 @@ function string2bb(element) { template: smiley_format }; this.attr('autocomplete','off'); - this.textcomplete([contacts,forums,smilies], {className:'acpopup', zIndex:1020}); + this.textcomplete([contacts,forums,smilies,tags], {className:'acpopup', zIndex:1020}); }; })( jQuery ); From 1700aedbed9050ca2eee621c04c29e5b34150bc5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 7 Mar 2018 17:29:01 -0800 Subject: [PATCH 3/3] remove extraneous logging --- Zotlabs/Module/Hashtags.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Zotlabs/Module/Hashtags.php b/Zotlabs/Module/Hashtags.php index d87a82818..edb631871 100644 --- a/Zotlabs/Module/Hashtags.php +++ b/Zotlabs/Module/Hashtags.php @@ -8,8 +8,6 @@ class Hashtags extends \Zotlabs\Web\Controller { function init() { $result = []; - logger(print_r($_REQUEST,true)); - $t = escape_tags($_REQUEST['t']); if(! $t) json_return_and_die($result); @@ -23,7 +21,7 @@ class Hashtags extends \Zotlabs\Web\Controller { $result[] = [ 'text' => strtolower($rv['term']) ]; } } - logger(print_r($result,true)); + json_return_and_die($result); } } \ No newline at end of file