forked from GNUsocial/gnu-social
[ENTITY][Actor] Add type field, which denotes whether the actor is a person, org, group, business or bot
This commit is contained in:
parent
e62896b84e
commit
1e8eea0434
@ -59,6 +59,7 @@ class Actor extends Entity
|
|||||||
private string $nickname;
|
private string $nickname;
|
||||||
private ?string $fullname = null;
|
private ?string $fullname = null;
|
||||||
private int $roles = 4;
|
private int $roles = 4;
|
||||||
|
private int $type;
|
||||||
private ?string $homepage;
|
private ?string $homepage;
|
||||||
private ?string $bio;
|
private ?string $bio;
|
||||||
private ?string $location;
|
private ?string $location;
|
||||||
@ -117,6 +118,17 @@ class Actor extends Entity
|
|||||||
return $this->roles;
|
return $this->roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setType(int $type): self
|
||||||
|
{
|
||||||
|
$this->type = $type;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getType(): int
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
public function setHomepage(?string $homepage): self
|
public function setHomepage(?string $homepage): self
|
||||||
{
|
{
|
||||||
$this->homepage = $homepage;
|
$this->homepage = $homepage;
|
||||||
@ -230,6 +242,12 @@ class Actor extends Entity
|
|||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
// }}} Autocode
|
// }}} Autocode
|
||||||
|
|
||||||
|
public const PERSON = 1;
|
||||||
|
public const GROUP = 2;
|
||||||
|
public const ORGANIZATION = 3;
|
||||||
|
public const BUSINESS = 4;
|
||||||
|
public const BOT = 5;
|
||||||
|
|
||||||
public static function cacheKeys(int $actor_id, mixed $other = null): array
|
public static function cacheKeys(int $actor_id, mixed $other = null): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -519,6 +537,7 @@ class Actor extends Entity
|
|||||||
'nickname' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username'],
|
'nickname' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username'],
|
||||||
'fullname' => ['type' => 'text', 'description' => 'display name'],
|
'fullname' => ['type' => 'text', 'description' => 'display name'],
|
||||||
'roles' => ['type' => 'int', 'not null' => true, 'default' => UserRoles::USER, 'description' => 'Bitmap of permissions this actor has'],
|
'roles' => ['type' => 'int', 'not null' => true, 'default' => UserRoles::USER, 'description' => 'Bitmap of permissions this actor has'],
|
||||||
|
'type' => ['type' => 'int', 'not null' => true, 'description' => 'The type of actor (person, group, bot, etc)'],
|
||||||
'homepage' => ['type' => 'text', 'description' => 'identifying URL'],
|
'homepage' => ['type' => 'text', 'description' => 'identifying URL'],
|
||||||
'bio' => ['type' => 'text', 'description' => 'descriptive biography'],
|
'bio' => ['type' => 'text', 'description' => 'descriptive biography'],
|
||||||
'location' => ['type' => 'text', 'description' => 'physical location'],
|
'location' => ['type' => 'text', 'description' => 'physical location'],
|
||||||
|
Loading…
Reference in New Issue
Block a user