1
0
Fork 0

set intro::duplex deprecated because of no usage

This commit is contained in:
Philipp Holzer 2021-10-21 21:48:23 +02:00
parent d67b676ce5
commit f5786a8f4f
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
7 changed files with 5 additions and 18 deletions

View file

@ -715,7 +715,7 @@ CREATE TABLE IF NOT EXISTS `intro` (
`contact-id` int unsigned NOT NULL DEFAULT 0 COMMENT '',
`suggest-cid` int unsigned COMMENT 'Suggested contact',
`knowyou` boolean NOT NULL DEFAULT '0' COMMENT '',
`duplex` boolean NOT NULL DEFAULT '0' COMMENT '',
`duplex` boolean NOT NULL DEFAULT '0' COMMENT 'deprecated',
`note` text COMMENT '',
`hash` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`datetime` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',

View file

@ -14,7 +14,7 @@ Fields
| contact-id | | int unsigned | NO | | 0 | |
| suggest-cid | Suggested contact | int unsigned | YES | | NULL | |
| knowyou | | boolean | NO | | 0 | |
| duplex | | boolean | NO | | 0 | |
| duplex | deprecated | boolean | NO | | 0 | |
| note | | text | YES | | NULL | |
| hash | | varchar(255) | NO | | | |
| datetime | | datetime | NO | | 0001-01-01 00:00:00 | |

View file

@ -71,7 +71,6 @@ class Introduction extends BaseDepository
'contact-id' => $introduction->cid,
'suggest-cid' => $introduction->sid,
'knowyou' => $introduction->knowyou ? 1 : 0,
'duplex' => $introduction->duplex ? 1 : 0,
'note' => $introduction->note,
'hash' => $introduction->hash,
'ignore' => $introduction->ignore ? 1 : 0,

View file

@ -28,7 +28,6 @@ use Friendica\BaseEntity;
* @property-read int $cid
* @property-read int|null $sid
* @property-read bool $knowyou
* @property-read bool $duplex
* @property-read string $note
* @property-read string $hash
* @property-read \DateTime $datetime
@ -45,8 +44,6 @@ class Introduction extends BaseEntity
protected $sid;
/** @var bool */
protected $knowyou;
/** @var bool */
protected $duplex;
/** @var string */
protected $note;
/** @var string */
@ -63,20 +60,18 @@ class Introduction extends BaseEntity
* @param int $cid
* @param int|null $sid
* @param bool $knowyou
* @param bool $duplex
* @param string $note
* @param string $hash
* @param \DateTime $datetime
* @param bool $ignore
* @param int|null $id
*/
public function __construct(int $uid, int $cid, ?int $sid, bool $knowyou, bool $duplex, string $note, string $hash, \DateTime $datetime, bool $ignore, ?int $id)
public function __construct(int $uid, int $cid, ?int $sid, bool $knowyou, string $note, string $hash, \DateTime $datetime, bool $ignore, ?int $id)
{
$this->uid = $uid;
$this->cid = $cid;
$this->sid = $sid;
$this->knowyou = $knowyou;
$this->duplex = $duplex;
$this->note = $note;
$this->hash = $hash;
$this->datetime = $datetime;

View file

@ -39,7 +39,6 @@ class Introduction extends BaseFactory implements ICanCreateFromTableRow
$row['contact-id'] ?? 0,
$row['suggest-cid'] ?? null,
!empty($row['knowyou']),
!empty($row['duplex']),
$row['note'] ?? '',
$row['hash'] ?? '',
new \DateTime($row['datetime'] ?? 'now', new \DateTimeZone('UTC')),
@ -53,15 +52,13 @@ class Introduction extends BaseFactory implements ICanCreateFromTableRow
int $cid,
string $note,
int $sid = null,
bool $knowyou = false,
bool $duplex = false
bool $knowyou = false
): Entity\Introduction {
return $this->createFromTableRow([
'uid' => $uid,
'suggest-cid' => $sid,
'contact-id' => $cid,
'knowyou' => $knowyou,
'duplex' => $duplex,
'note' => $note,
'hash' => Strings::getRandomHex(),
'datetime' => DateTimeFormat::utcNow(),

View file

@ -778,7 +778,7 @@ return [
"contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
"suggest-cid" => ["type" => "int unsigned", "foreign" => ["contact" => "id"], "comment" => "Suggested contact"],
"knowyou" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
"duplex" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "deprecated"],
"note" => ["type" => "text", "comment" => ""],
"hash" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"datetime" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],

View file

@ -17,7 +17,6 @@ class IntroductionTest extends TestCase
'suggest-cid' => 13,
'contact-id' => 24,
'knowyou' => 1,
'duplex' => 1,
'note' => 'a note',
'hash' => '12345',
'datetime' => '1970-01-01 00:00:00',
@ -29,7 +28,6 @@ class IntroductionTest extends TestCase
'suggest-cid' => 13,
'contact-id' => 24,
'knowyou' => true,
'duplex' => true,
'note' => 'a note',
'hash' => '12345',
'datetime' => new \DateTime('1970-01-01 00:00:00', new \DateTimeZone('UTC')),
@ -45,7 +43,6 @@ class IntroductionTest extends TestCase
'contact-id' => 0,
'suggest-cid' => null,
'knowyou' => false,
'duplex' => false,
'note' => '',
'ignore' => false,
'id' => null,
@ -61,7 +58,6 @@ class IntroductionTest extends TestCase
self::assertEquals($intro->cid, $assertion['contact-id'] ?? 0);
self::assertEquals($intro->sid, $assertion['suggest-cid'] ?? null);
self::assertEquals($intro->knowyou, $assertion['knowyou'] ?? false);
self::assertEquals($intro->duplex, $assertion['duplex'] ?? false);
self::assertEquals($intro->note, $assertion['note'] ?? '');
if (isset($assertion['hash'])) {
self::assertEquals($intro->hash, $assertion['hash']);