[CORE][VisibilityScope] Use enum type instead of Bitmap
This commit is contained in:
@@ -58,7 +58,7 @@ class Note extends Entity
|
||||
private ?int $reply_to = null;
|
||||
private bool $is_local;
|
||||
private ?string $source;
|
||||
private int $scope = 1;
|
||||
private int $scope = 1; //VisibilityScope::EVERYWHERE->value;
|
||||
private ?string $url;
|
||||
private ?int $language_id;
|
||||
private \DateTimeInterface $created;
|
||||
@@ -163,15 +163,15 @@ class Note extends Entity
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
public function setScope(int $scope): self
|
||||
public function setScope(VisibilityScope|int $scope): self
|
||||
{
|
||||
$this->scope = $scope;
|
||||
$this->scope = is_int($scope) ? $scope : $scope->value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getScope(): int
|
||||
public function getScope(): VisibilityScope
|
||||
{
|
||||
return $this->scope;
|
||||
return VisibilityScope::from($this->scope);
|
||||
}
|
||||
|
||||
public function setUrl(?string $url): self
|
||||
@@ -484,7 +484,7 @@ class Note extends Entity
|
||||
'reply_to' => ['type' => 'int', 'not null' => false, 'default' => null, 'foreign key' => true, 'target' => 'Note.id', 'multiplicity' => 'one to one', 'description' => 'note replied to, null if root of a conversation'],
|
||||
'is_local' => ['type' => 'bool', 'not null' => true, 'description' => 'was this note generated by a local actor'],
|
||||
'source' => ['type' => 'varchar', 'foreign key' => true, 'length' => 32, 'target' => 'NoteSource.code', 'multiplicity' => 'many to one', 'description' => 'fkey to source of note, like "web", "im", or "clientname"'],
|
||||
'scope' => ['type' => 'int', 'not null' => true, 'default' => VisibilityScope::PUBLIC, 'description' => 'bit map for distribution scope; 1 = everywhere; 2 = this server only; 4 = addressees; 8 = groups; 16 = collection; 32 = messages'],
|
||||
'scope' => ['type' => 'int', 'not null' => true, 'default' => VisibilityScope::EVERYWHERE->value, 'description' => 'bit map for distribution scope; 1 = everywhere; 2 = this server only; 4 = addressees; 8 = groups; 16 = collection; 32 = messages'],
|
||||
'url' => ['type' => 'text', 'description' => 'Permalink to Note'],
|
||||
'language_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Language.id', 'multiplicity' => 'one to many', 'description' => 'The language for this note'],
|
||||
'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
|
||||
|
Reference in New Issue
Block a user