[ENTITY][Actor] Add is_local, it's common to depend, and this makes it much faster, with a low space cost
This commit is contained in:
@@ -49,9 +49,8 @@ class Note extends Entity
|
||||
private ?string $content_type = null;
|
||||
private ?string $content = null;
|
||||
private ?string $rendered = null;
|
||||
private ?bool $is_local;
|
||||
private bool $is_local;
|
||||
private ?string $source;
|
||||
private ?int $conversation;
|
||||
private int $scope = VisibilityScope::PUBLIC;
|
||||
private string $url;
|
||||
private string $language;
|
||||
@@ -116,13 +115,13 @@ class Note extends Entity
|
||||
return $this->rendered;
|
||||
}
|
||||
|
||||
public function setIsLocal(?bool $is_local): self
|
||||
public function setIsLocal(bool $is_local): self
|
||||
{
|
||||
$this->is_local = $is_local;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIsLocal(): ?bool
|
||||
public function getIsLocal(): bool
|
||||
{
|
||||
return $this->is_local;
|
||||
}
|
||||
@@ -138,17 +137,6 @@ class Note extends Entity
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
public function setConversation(?int $conversation): self
|
||||
{
|
||||
$this->conversation = $conversation;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConversation(): ?int
|
||||
{
|
||||
return $this->conversation;
|
||||
}
|
||||
|
||||
public function setScope(int $scope): self
|
||||
{
|
||||
$this->scope = $scope;
|
||||
@@ -290,15 +278,6 @@ class Note extends Entity
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Actor[]
|
||||
*/
|
||||
public function getAttentionProfiles(): array
|
||||
{
|
||||
// TODO implement
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
@@ -309,9 +288,8 @@ class Note extends Entity
|
||||
'content' => ['type' => 'text', 'description' => 'note content'],
|
||||
'content_type' => ['type' => 'varchar', 'not null' => true, 'default' => 'text/plain', 'length' => 129, 'description' => 'A note can be written in a multitude of formats such as text/plain, text/markdown, application/x-latex, and text/html'],
|
||||
'rendered' => ['type' => 'text', 'description' => 'rendered note content, so we can keep the microtags (if not local)'],
|
||||
'is_local' => ['type' => 'bool', 'description' => 'was this note generated by a local actor'],
|
||||
'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"'],
|
||||
'conversation' => ['type' => 'int', 'foreign key' => true, 'target' => 'Conversation.id', 'multiplicity' => 'one to one', 'description' => 'the local conversation id'],
|
||||
'scope' => ['type' => 'int', 'not null' => true, 'default' => VisibilityScope::PUBLIC, 'description' => 'bit map for distribution scope; 0 = everywhere; 1 = this server only; 2 = addressees; 4 = groups; 8 = subscribers; 16 = messages; null = default'],
|
||||
'url' => ['type' => 'text', 'description' => 'Permalink to Note'],
|
||||
'language' => ['type' => 'int', 'foreign key' => true, 'target' => 'Language.id', 'multiplicity' => 'one to many', 'description' => 'The language for this note'],
|
||||
@@ -323,7 +301,6 @@ class Note extends Entity
|
||||
'note_created_id_is_local_idx' => ['created', 'is_local'],
|
||||
'note_actor_created_idx' => ['actor_id', 'created'],
|
||||
'note_is_local_created_actor_idx' => ['is_local', 'created', 'actor_id'],
|
||||
'note_conversation_created_idx' => ['conversation', 'created'],
|
||||
],
|
||||
'fulltext indexes' => ['notice_fulltext_idx' => ['content']], // TODO make this configurable
|
||||
];
|
||||
|
Reference in New Issue
Block a user