aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-05-01 10:07:07 +0200
committerMario <mario@mariovavti.com>2019-05-01 10:07:07 +0200
commitb8d8887d5a97d458ffeff8bf36c8feb5843f1dd4 (patch)
treee97b380f60f7a15ce883cc31d7ce869788beeb91 /Zotlabs
parent256f8dd41b9e22f2b16bf5d912228f84952c748a (diff)
parente0fdafc7e5adfce2e629b6e55c25e0c4c665a64e (diff)
downloadvolse-hubzilla-b8d8887d5a97d458ffeff8bf36c8feb5843f1dd4.tar.gz
volse-hubzilla-b8d8887d5a97d458ffeff8bf36c8feb5843f1dd4.tar.bz2
volse-hubzilla-b8d8887d5a97d458ffeff8bf36c8feb5843f1dd4.zip
Merge branch 'dev' into 'dev'
a couple of issues with the suggestions when viewing from the directory module See merge request hubzilla/core!1615
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;
+ }
+
}