]> git.mxchange.org Git - friendica.git/commitdiff
Insert and update some more fields
authorMichael <heluecht@pirati.ca>
Fri, 10 Sep 2021 20:53:10 +0000 (20:53 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 10 Sep 2021 20:53:10 +0000 (20:53 +0000)
database.sql
doc/database/db_user-contact.md
src/Model/Contact/User.php
static/dbstructure.config.php

index dd04a0e352efe918045af45cf63095b06b3147ce..adbd5046a15158001d26cfbdbb81c4a1b8d0466e 100644 (file)
@@ -1516,6 +1516,11 @@ CREATE TABLE IF NOT EXISTS `user-contact` (
        `blocked` boolean COMMENT 'Contact is completely blocked for this user',
        `ignored` boolean COMMENT 'Posts from this contact are ignored',
        `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
+       `rel` tinyint unsigned COMMENT 'The kind of the relation between the user and the contact',
+       `info` mediumtext COMMENT '',
+       `notify_new_posts` boolean COMMENT '',
+       `fetch_further_information` tinyint unsigned COMMENT '',
+       `ffi_keyword_denylist` text COMMENT '',
         PRIMARY KEY(`uid`,`cid`),
         INDEX `cid` (`cid`),
         UNIQUE INDEX `uri-id_uid` (`uri-id`,`uid`),
index 467ee86d90d4ea1c133e8ea0d0988b0f848b102c..aa74516f1771178024fa63b217a96742474feb99 100644 (file)
@@ -6,14 +6,19 @@ User specific public contact data
 Fields
 ------
 
-| Field     | Description                                                  | Type               | Null | Key | Default | Extra |
-| --------- | ------------------------------------------------------------ | ------------------ | ---- | --- | ------- | ----- |
-| cid       | Contact id of the linked public contact                      | int unsigned       | NO   | PRI | 0       |       |
-| uid       | User id                                                      | mediumint unsigned | NO   | PRI | 0       |       |
-| uri-id    | Id of the item-uri table entry that contains the contact url | int unsigned       | YES  |     | NULL    |       |
-| blocked   | Contact is completely blocked for this user                  | boolean            | YES  |     | NULL    |       |
-| ignored   | Posts from this contact are ignored                          | boolean            | YES  |     | NULL    |       |
-| collapsed | Posts from this contact are collapsed                        | boolean            | YES  |     | NULL    |       |
+| Field                     | Description                                                  | Type               | Null | Key | Default | Extra |
+| ------------------------- | ------------------------------------------------------------ | ------------------ | ---- | --- | ------- | ----- |
+| cid                       | Contact id of the linked public contact                      | int unsigned       | NO   | PRI | 0       |       |
+| uid                       | User id                                                      | mediumint unsigned | NO   | PRI | 0       |       |
+| uri-id                    | Id of the item-uri table entry that contains the contact url | int unsigned       | YES  |     | NULL    |       |
+| blocked                   | Contact is completely blocked for this user                  | boolean            | YES  |     | NULL    |       |
+| ignored                   | Posts from this contact are ignored                          | boolean            | YES  |     | NULL    |       |
+| collapsed                 | Posts from this contact are collapsed                        | boolean            | YES  |     | NULL    |       |
+| rel                       | The kind of the relation between the user and the contact    | tinyint unsigned   | YES  |     | NULL    |       |
+| info                      |                                                              | mediumtext         | YES  |     | NULL    |       |
+| notify_new_posts          |                                                              | boolean            | YES  |     | NULL    |       |
+| fetch_further_information |                                                              | tinyint unsigned   | YES  |     | NULL    |       |
+| ffi_keyword_denylist      |                                                              | text               | YES  |     | NULL    |       |
 
 Indexes
 ------------
index e46af5191f39dfeed5c31dda54334ef4af8ffdb0..bf6fa8a947cad06ca40e41ee2471627db5410317 100644 (file)
@@ -22,6 +22,7 @@
 namespace Friendica\Model\Contact;
 
 use Exception;
+use Friendica\Collection\Api\Mastodon\Fields;
 use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\Database\Database;
@@ -59,13 +60,16 @@ class User
                        return false;
                }
 
-               $fields = [
-                       'cid'     => $pcontact['id'],
-                       'uid'     => $contact['uid'],
-                       'uri-id'  => $contact['uri-id'],
-                       'blocked' => $contact['blocked'] ?? false,
-                       'ignored' => $contact['readonly'] ?? false,
-               ];
+               $fields = $contact;
+
+               if (isset($fields['readonly'])) {
+                       $fields['ignored'] = $fields['readonly'];
+               }
+
+               $fields = DBStructure::getFieldsForTable('user-contact', $fields);
+               $fields['cid'] = $pcontact['id'];
+               $fields['uid'] = $contact['uid'];
+               $fields['uri-id'] = $contact['uri-id'];
 
                $ret = DBA::insert('user-contact', $fields, Database::INSERT_IGNORE);
 
index fd6c4c798fdc5b60b2bcceda12326bfe31ac8bd6..b501ea4df57195aa796e35ae26af37b310c9f4fe 100644 (file)
@@ -1534,7 +1534,12 @@ return [
                        "uri-id" => ["type" => "int unsigned", "foreign" => ["item-uri" => "id"], "comment" => "Id of the item-uri table entry that contains the contact url"],
                        "blocked" => ["type" => "boolean", "comment" => "Contact is completely blocked for this user"],
                        "ignored" => ["type" => "boolean", "comment" => "Posts from this contact are ignored"],
-                       "collapsed" => ["type" => "boolean", "comment" => "Posts from this contact are collapsed"]
+                       "collapsed" => ["type" => "boolean", "comment" => "Posts from this contact are collapsed"],
+                       "rel" => ["type" => "tinyint unsigned", "comment" => "The kind of the relation between the user and the contact"],
+                       "info" => ["type" => "mediumtext", "comment" => ""],
+                       "notify_new_posts" => ["type" => "boolean", "comment" => ""],
+                       "fetch_further_information" => ["type" => "tinyint unsigned", "comment" => ""],
+                       "ffi_keyword_denylist" => ["type" => "text", "comment" => ""],
                ],
                "indexes" => [
                        "PRIMARY" => ["uid", "cid"],