diff options
author | zotlabs <mike@macgirvin.com> | 2019-04-30 23:19:04 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2019-04-30 23:19:04 -0700 |
commit | 9800d95c50d457440969e5419cb4a7742c57eedd (patch) | |
tree | bedd46e426f7ffb145fbc4c14cf3a36fd5d3dfae /Zotlabs | |
parent | 96412544434fdcf06971afdccb19e9e8dd3ea607 (diff) | |
download | volse-hubzilla-9800d95c50d457440969e5419cb4a7742c57eedd.tar.gz volse-hubzilla-9800d95c50d457440969e5419cb4a7742c57eedd.tar.bz2 volse-hubzilla-9800d95c50d457440969e5419cb4a7742c57eedd.zip |
fix suggestion ordering in directory module
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Directory.php | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index 5448a4816..f26040629 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -212,12 +212,17 @@ class Directory extends \Zotlabs\Web\Controller { if($j) { if($j['results']) { - + + $results = $j['results']; + if($suggest) { + $results = self::reorder_results($results,$addresses); + } + $entries = array(); $photo = 'thumb'; - foreach($j['results'] as $rr) { + foreach($results as $rr) { $profile_link = chanlink_url($rr['url']); @@ -438,5 +443,22 @@ class Directory extends \Zotlabs\Web\Controller { return $o; } - + static public function reorder_results($results,$suggests) { + + if(! $suggests) + return $results; + + $out = []; + foreach($suggests as $k => $v) { + foreach($results as $rv) { + if($k == $rv['address']) { + $out[intval($v)] = $rv; + break; + } + } + } + + return $out; + } + } |