]> git.mxchange.org Git - friendica.git/commitdiff
Random profiles now moved away from "gcontact" as well
authorMichael <heluecht@pirati.ca>
Sun, 2 Aug 2020 08:07:31 +0000 (08:07 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 2 Aug 2020 08:07:31 +0000 (08:07 +0000)
src/Model/Contact.php
src/Model/GContact.php
src/Module/RandomProfile.php
view/theme/frio/templates/widget/peoplefind.tpl

index 18c378179e329284bacbf0cebf3ecf1e3ceea7b3..325183e10b0d0f3c85af70b9daf7119b4f485052 100644 (file)
@@ -3259,4 +3259,24 @@ class Contact
                $fields = ['failed' => false, 'last_contact' => DateTimeFormat::utcNow(), 'updated' => $last_updated];
                DBA::update('contact', $fields, ['nurl' => Strings::normaliseLink($data['url'])]);
        }
+
+       /**
+        * Returns a random, global contact of the current node
+        *
+        * @return string The profile URL
+        * @throws Exception
+        */
+       public static function getRandomUrl()
+       {
+               $r = DBA::selectFirst('contact', ['url'], [
+                       "`uid` = ? AND `network` = ? AND NOT `failed` AND `last-item` > ?",
+                       0, Protocol::DFRN, DateTimeFormat::utc('now - 1 month'),
+               ], ['order' => ['RAND()']]);
+
+               if (DBA::isResult($r)) {
+                       return $r['url'];
+               }
+
+               return '';
+       }
 }
index 6549e9efe23de0dbc410ec1340e66593f20845e4..ce224f44c03a05737f16dfb243e35154ef945c9c 100644 (file)
@@ -205,27 +205,4 @@ class GContact
                /// @TODO Check all calling-findings of this function if they properly use DBA::isResult()
                return $r;
        }
-
-       /**
-        * Returns a random, global contact of the current node
-        *
-        * @return string The profile URL
-        * @throws Exception
-        */
-       public static function getRandomUrl()
-       {
-               $r = DBA::selectFirst('gcontact', ['url'], [
-                       '`network` = ?
-                       AND NOT `failed`
-                       AND `updated` > ?',
-                       Protocol::DFRN,
-                       DateTimeFormat::utc('now - 1 month'),
-               ], ['order' => ['RAND()']]);
-
-               if (DBA::isResult($r)) {
-                       return $r['url'];
-               }
-
-               return '';
-       }
 }
index 111d92dc40d638ec3fcc1433f8932a4c9392301b..65ce5659592e7bcce2e72704d6482f724b36321a 100644 (file)
@@ -24,7 +24,6 @@ namespace Friendica\Module;
 use Friendica\BaseModule;
 use Friendica\DI;
 use Friendica\Model\Contact;
-use Friendica\Model\GContact;
 
 /**
  * Redirects to a random Friendica profile this node knows about
@@ -35,7 +34,7 @@ class RandomProfile extends BaseModule
        {
                $a = DI::app();
 
-               $contactUrl = GContact::getRandomUrl();
+               $contactUrl = Contact::getRandomUrl();
 
                if ($contactUrl) {
                        $link = Contact::magicLink($contactUrl);
index fc5d249b4b5c7e97c66e129895396fee6366ca6b..b6d1e3ff27a1e3f93f7c496083446381d25e399f 100644 (file)
@@ -16,6 +16,7 @@
        {{* Additional links *}}
        <div class="side-link" id="side-match-link"><a href="match" >{{$nv.similar}}</a></div>
        <div class="side-link" id="side-suggest-link"><a href="suggest" >{{$nv.suggest}}</a></div>
+       <div class="side-link" id="side-random-profile-link" ><a href="randprof" target="extlink" >{{$nv.random}}</a></div>
 
        {{if $nv.inv}} 
        <div class="side-link" id="side-invite-link" ><button type="button" class="btn-link" onclick="addToModal('invite'); return false;">{{$nv.inv}}</button></div>