aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-04-30 23:39:56 -0700
committerzotlabs <mike@macgirvin.com>2019-04-30 23:39:56 -0700
commite0fdafc7e5adfce2e629b6e55c25e0c4c665a64e (patch)
tree9202853a9f5732913833fee895d59aa1a5c60a9a /Zotlabs
parentd89d6e8a01ef9af0d300c192367445c385e0252b (diff)
parent9a55df245f4829900a3265fbb1cac56779e2b06e (diff)
downloadvolse-hubzilla-e0fdafc7e5adfce2e629b6e55c25e0c4c665a64e.tar.gz
volse-hubzilla-e0fdafc7e5adfce2e629b6e55c25e0c4c665a64e.tar.bz2
volse-hubzilla-e0fdafc7e5adfce2e629b6e55c25e0c4c665a64e.zip
Merge branch 'dev' of ../hz into dev
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Directory.php38
1 files changed, 33 insertions, 5 deletions
diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php
index 5448a4816..8f5db6635 100644
--- a/Zotlabs/Module/Directory.php
+++ b/Zotlabs/Module/Directory.php
@@ -103,8 +103,14 @@ class Directory extends \Zotlabs\Web\Controller {
$suggest = (local_channel() && x($_REQUEST,'suggest')) ? $_REQUEST['suggest'] : '';
if($suggest) {
-
- $r = suggestion_query(local_channel(),get_observer_hash());
+
+ // the directory options have no effect in suggestion mode
+
+ $globaldir = 1;
+ $safe_mode = 1;
+ $type = 0;
+
+ $r = suggestion_query(local_channel(),get_observer_hash(),0,60);
if(! $r) {
notice( t('No default suggestions were found.') . EOL);
@@ -212,12 +218,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 +449,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;
+ }
+
}