[ENTITY][ActorTag][ActorTagBlock] Add 'use_canonical' column

This commit is contained in:
Hugo Sales 2021-12-05 17:51:16 +00:00
parent 9f445632b2
commit 259e07b259
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 35 additions and 14 deletions

View File

@ -50,6 +50,7 @@ class ActorTag extends Entity
private int $tagged; private int $tagged;
private string $tag; private string $tag;
private string $canonical; private string $canonical;
private bool $use_canonical;
private DateTimeInterface $modified; private DateTimeInterface $modified;
public function setTagger(int $tagger): self public function setTagger(int $tagger): self
@ -96,6 +97,17 @@ class ActorTag extends Entity
return $this->canonical; return $this->canonical;
} }
public function setUseCanonical(bool $use_canonical): self
{
$this->use_canonical = $use_canonical;
return $this;
}
public function getUseCanonical(): bool
{
return $this->use_canonical;
}
public function setModified(DateTimeInterface $modified): self public function setModified(DateTimeInterface $modified): self
{ {
$this->modified = $modified; $this->modified = $modified;
@ -141,6 +153,7 @@ class ActorTag extends Entity
'tagged' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to one', 'name' => 'actor_tag_tagged_fkey', 'not null' => true, 'description' => 'actor tagged'], 'tagged' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to one', 'name' => 'actor_tag_tagged_fkey', 'not null' => true, 'description' => 'actor tagged'],
'tag' => ['type' => 'varchar', 'length' => Tag::MAX_TAG_LENGTH, 'not null' => true, 'description' => 'hash tag associated with this actor'], 'tag' => ['type' => 'varchar', 'length' => Tag::MAX_TAG_LENGTH, 'not null' => true, 'description' => 'hash tag associated with this actor'],
'canonical' => ['type' => 'varchar', 'length' => Tag::MAX_TAG_LENGTH, 'not null' => true, 'description' => 'ascii slug of tag'], 'canonical' => ['type' => 'varchar', 'length' => Tag::MAX_TAG_LENGTH, 'not null' => true, 'description' => 'ascii slug of tag'],
'use_canonical' => ['type' => 'bool', 'not null' => true, 'description' => 'whether the user wanted to block canonical tags'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
], ],
'primary key' => ['tagger', 'tagged', 'canonical'], 'primary key' => ['tagger', 'tagged', 'canonical'],
@ -151,9 +164,4 @@ class ActorTag extends Entity
], ],
]; ];
} }
public function __toString()
{
return $this->getTag();
}
} }

View File

@ -45,6 +45,7 @@ class ActorTagBlock extends Entity
private int $blocker; private int $blocker;
private string $tag; private string $tag;
private string $canonical; private string $canonical;
private bool $use_canonical;
private DateTimeInterface $modified; private DateTimeInterface $modified;
public function setBlocker(int $blocker): self public function setBlocker(int $blocker): self
@ -80,6 +81,17 @@ class ActorTagBlock extends Entity
return $this->canonical; return $this->canonical;
} }
public function setUseCanonical(bool $use_canonical): self
{
$this->use_canonical = $use_canonical;
return $this;
}
public function getUseCanonical(): bool
{
return $this->use_canonical;
}
public function setModified(DateTimeInterface $modified): self public function setModified(DateTimeInterface $modified): self
{ {
$this->modified = $modified; $this->modified = $modified;
@ -121,6 +133,7 @@ class ActorTagBlock extends Entity
'blocker' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'many to one', 'name' => 'actor_block_blocker_fkey', 'not null' => true, 'description' => 'user making the block'], 'blocker' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'many to one', 'name' => 'actor_block_blocker_fkey', 'not null' => true, 'description' => 'user making the block'],
'tag' => ['type' => 'varchar', 'length' => Tag::MAX_TAG_LENGTH, 'not null' => true, 'description' => 'hash tag this is blocking'], 'tag' => ['type' => 'varchar', 'length' => Tag::MAX_TAG_LENGTH, 'not null' => true, 'description' => 'hash tag this is blocking'],
'canonical' => ['type' => 'varchar', 'length' => Tag::MAX_TAG_LENGTH, 'foreign key' => true, 'target' => 'NoteTag.canonical', 'multiplicity' => 'many to one', 'not null' => true, 'description' => 'ascii slug of tag'], 'canonical' => ['type' => 'varchar', 'length' => Tag::MAX_TAG_LENGTH, 'foreign key' => true, 'target' => 'NoteTag.canonical', 'multiplicity' => 'many to one', 'not null' => true, 'description' => 'ascii slug of tag'],
'use_canonical' => ['type' => 'bool', 'not null' => true, 'description' => 'whether the user wanted to block canonical tags'],
'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
], ],
'primary key' => ['blocker', 'canonical'], 'primary key' => ['blocker', 'canonical'],