]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Post/ThreadUser.php
Merge pull request #12298 from annando/api-suggestions
[friendica.git] / src / Model / Post / ThreadUser.php
index b0a30c486e66987b5243f2fa42405a22e050f71f..a6a3bbd92b2eeeb0b1cd91240d4513ba6260156f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -25,6 +25,7 @@ use \BadMethodCallException;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
+use Friendica\DI;
 
 class ThreadUser
 {
@@ -43,7 +44,7 @@ class ThreadUser
                        throw new BadMethodCallException('Empty URI_id');
                }
 
-               $fields = DBStructure::getFieldsForTable('post-thread-user', $data);
+               $fields = DI::dbaDefinition()->truncateFieldsForTable('post-thread-user', $data);
 
                // Additionally assign the key fields
                $fields['uri-id'] = $uri_id;
@@ -68,7 +69,7 @@ class ThreadUser
                        throw new BadMethodCallException('Empty URI_id');
                }
 
-               $fields = DBStructure::getFieldsForTable('post-thread-user', $data);
+               $fields = DI::dbaDefinition()->truncateFieldsForTable('post-thread-user', $data);
 
                // Remove the key fields
                unset($fields['uri-id']);
@@ -123,31 +124,4 @@ class ThreadUser
        {
                DBA::update('post-thread-user', ['ignored' => $ignored], ['uri-id' => $uri_id, 'uid' => $uid], true);
        }
-
-       /**
-        * @param int $uri_id 
-        * @param int $uid 
-        * @return bool 
-        * @throws Exception 
-        */
-       public static function getPinned(int $uri_id, int $uid)
-       {
-               $threaduser = DBA::selectFirst('post-thread-user', ['pinned'], ['uri-id' => $uri_id, 'uid' => $uid]);
-               if (empty($threaduser)) {
-                       return false;
-               }
-               return (bool)$threaduser['pinned'];
-       }
-
-       /**
-        * @param int $uri_id 
-        * @param int $uid 
-        * @param int $pinned 
-        * @return void 
-        * @throws Exception 
-        */
-       public static function setPinned(int $uri_id, int $uid, int $pinned)
-       {
-               DBA::update('post-thread-user', ['pinned' => $pinned], ['uri-id' => $uri_id, 'uid' => $uid], true);
-       }
 }