]> git.mxchange.org Git - friendica.git/commitdiff
Fix self-contact creation
authorHypolite Petovan <mrpetovan@gmail.com>
Wed, 13 Dec 2017 01:44:05 +0000 (20:44 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Wed, 13 Dec 2017 01:44:05 +0000 (20:44 -0500)
- Discard useless intval()
- Add proper condition for `self`

src/Model/Contact.php

index d7f27ddd557fcde3cabafc834d8e891e369b9430..2e1bc01c741c070fe27b9c3e37310330a3f5670e 100644 (file)
@@ -96,11 +96,11 @@ class Contact extends BaseObject
        public static function createSelfFromUserId($uid)
        {
                // Only create the entry if it doesn't exist yet
-               if (dba::exists('contact', ['uid' => intval($uid), 'self'])) {
+               if (dba::exists('contact', ['uid' => $uid, 'self' => true])) {
                        return true;
                }
 
-               $user = dba::select('user', ['uid', 'username', 'nickname'], ['uid' => intval($uid)], ['limit' => 1]);
+               $user = dba::select('user', ['uid', 'username', 'nickname'], ['uid' => $uid], ['limit' => 1]);
                if (!DBM::is_result($user)) {
                        return false;
                }