forked from GNUsocial/gnu-social
[CORE][Entity][Note] Language can be null
This commit is contained in:
parent
19b8a7648e
commit
63bf93d7f3
@ -85,9 +85,6 @@ class Note extends Entity
|
|||||||
return $this->content_type;
|
return $this->content_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Note
|
|
||||||
*/
|
|
||||||
public function setContentType(string $content_type): self
|
public function setContentType(string $content_type): self
|
||||||
{
|
{
|
||||||
$this->content_type = $content_type;
|
$this->content_type = $content_type;
|
||||||
@ -221,14 +218,14 @@ class Note extends Entity
|
|||||||
return Cache::get("note-{$note_id}", fn () => DB::findOneBy('note', ['id' => $note_id]));
|
return Cache::get("note-{$note_id}", fn () => DB::findOneBy('note', ['id' => $note_id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNoteLanguageShortDisplay(): string
|
public function getNoteLanguageShortDisplay(): ?string
|
||||||
{
|
{
|
||||||
return Language::getById($this->language_id)->getShortDisplay();
|
return !is_null($this->language_id) ? Language::getById($this->language_id)->getShortDisplay() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLanguageLocale(): string
|
public function getLanguageLocale(): ?string
|
||||||
{
|
{
|
||||||
return Language::getById($this->language_id)->getLocale();
|
return !is_null($this->language_id) ? Language::getById($this->language_id)->getLocale() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAllNotesByActor(Actor $actor): array
|
public static function getAllNotesByActor(Actor $actor): array
|
||||||
|
Loading…
Reference in New Issue
Block a user