aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-04-25 18:41:19 -0700
committerzotlabs <mike@macgirvin.com>2018-04-25 18:41:19 -0700
commitf923d21df341546e054eb0f9628891365c4c2d62 (patch)
treebcbd5ca129c235c19bb7b0f6e319834d99eb26e6
parent5a9e9284c260c8bb880987c0942a9fe040442a2b (diff)
downloadvolse-hubzilla-f923d21df341546e054eb0f9628891365c4c2d62.tar.gz
volse-hubzilla-f923d21df341546e054eb0f9628891365c4c2d62.tar.bz2
volse-hubzilla-f923d21df341546e054eb0f9628891365c4c2d62.zip
some tagging work
-rw-r--r--Zotlabs/Module/Acl.php18
-rw-r--r--include/text.php15
-rw-r--r--view/js/autocomplete.js30
3 files changed, 39 insertions, 24 deletions
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index 35594ae9f..b1f75263d 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -268,15 +268,15 @@ class Acl extends \Zotlabs\Web\Controller {
});
}
}
- if(intval(get_config('system','taganyone')) || intval(get_pconfig(local_channel(),'system','taganyone'))) {
- if((count($r) < 100) && $type == 'c') {
- $r2 = q("SELECT substr(xchan_hash,1,18) as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_their_perms, 0 as abook_flags, 0 as abook_self
- FROM xchan
- WHERE xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc"
- );
- if($r2)
- $r = array_merge($r,$r2);
- }
+ if((count($r) < 100) && $type == 'c') {
+ $r2 = q("SELECT substr(xchan_hash,1,18) as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_their_perms, 0 as abook_flags, 0 as abook_self
+ FROM xchan
+ WHERE xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc"
+ );
+ if($r2) {
+ $r = array_merge($r,$r2);
+ $r = unique_multidim_array($r,'hash');
+ }
}
}
elseif($type == 'm') {
diff --git a/include/text.php b/include/text.php
index 60f6ff383..645c15df0 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3402,3 +3402,18 @@ function unpunify($s) {
}
+
+function unique_multidim_array($array, $key) {
+ $temp_array = array();
+ $i = 0;
+ $key_array = array();
+
+ foreach($array as $val) {
+ if (!in_array($val[$key], $key_array)) {
+ $key_array[$i] = $val[$key];
+ $temp_array[$i] = $val;
+ }
+ $i++;
+ }
+ return $temp_array;
+} \ No newline at end of file
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 76c3fb69e..0a440aa90 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -8,20 +8,20 @@ function contact_search(term, callback, backend_url, type, extra_channels, spine
$(spinelement).show();
}
// Check if there is a cached result that contains the same information we would get with a full server-side search
- var bt = backend_url+type;
- if(!(bt in contact_search.cache)) contact_search.cache[bt] = {};
+// var bt = backend_url+type;
+// if(!(bt in contact_search.cache)) contact_search.cache[bt] = {};
- var lterm = term.toLowerCase(); // Ignore case
- for(var t in contact_search.cache[bt]) {
- if(lterm.indexOf(t) >= 0) { // A more broad search has been performed already, so use those results
- $(spinelement).hide();
+// var lterm = term.toLowerCase(); // Ignore case
+// for(var t in contact_search.cache[bt]) {
+// if(lterm.indexOf(t) >= 0) { // A more broad search has been performed already, so use those results
+// $(spinelement).hide();
// Filter old results locally
- var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || (typeof x.nick !== 'undefined' && x.nick.toLowerCase().indexOf(lterm) >= 0)); }); // Need to check that nick exists because groups don't have one
- matching.unshift({taggable:false, text: term, replace: term});
- setTimeout(function() { callback(matching); } , 1); // Use "pseudo-thread" to avoid some problems
- return;
- }
- }
+// var matching = contact_search.cache[bt][t].filter(function (x) { return (x.name.toLowerCase().indexOf(lterm) >= 0 || (typeof x.nick !== 'undefined' && x.nick.toLowerCase().indexOf(lterm) >= 0)); }); // Need to check that nick exists because groups don't have one
+// matching.unshift({taggable:false, text: term, replace: term});
+// setTimeout(function() { callback(matching); } , 1); // Use "pseudo-thread" to avoid some problems
+// return;
+// }
+// }
var postdata = {
start:0,
@@ -41,9 +41,9 @@ function contact_search(term, callback, backend_url, type, extra_channels, spine
success: function(data){
// Cache results if we got them all (more information would not improve results)
// data.count represents the maximum number of items
- if(data.items.length -1 < data.count) {
- contact_search.cache[bt][lterm] = data.items;
- }
+// if(data.items.length -1 < data.count) {
+// contact_search.cache[bt][lterm] = data.items;
+// }
var items = data.items.slice(0);
items.unshift({taggable:false, text: term, replace: term});
callback(items);