[Controller][Security] Fullname is not setup automatically upon registering anymore.
[ENTITY][Actor] Changes to accomodate fullname from potentially being null. [ENTITY][Note] Changes to accomodate fullname from potentially being null.
This commit is contained in:
parent
ac8513741d
commit
91dd6e1428
@ -135,7 +135,7 @@ class Security extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// This already checks if the nickname is being used
|
// This already checks if the nickname is being used
|
||||||
$actor = Actor::create(['nickname' => $sanitized_nickname, 'fullname' => $sanitized_nickname]);
|
$actor = Actor::create(['nickname' => $sanitized_nickname]);
|
||||||
$user = LocalUser::create([
|
$user = LocalUser::create([
|
||||||
'nickname' => $sanitized_nickname,
|
'nickname' => $sanitized_nickname,
|
||||||
'outgoing_email' => $data['email'],
|
'outgoing_email' => $data['email'],
|
||||||
|
@ -54,7 +54,7 @@ class Actor extends Entity
|
|||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
private int $id;
|
private int $id;
|
||||||
private string $nickname;
|
private string $nickname;
|
||||||
private string $fullname;
|
private ?string $fullname = null;
|
||||||
private int $roles = 4;
|
private int $roles = 4;
|
||||||
private ?string $homepage;
|
private ?string $homepage;
|
||||||
private ?string $bio;
|
private ?string $bio;
|
||||||
@ -95,8 +95,11 @@ class Actor extends Entity
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFullname(): string
|
public function getFullname(): ?string
|
||||||
{
|
{
|
||||||
|
if (is_null($this->fullname)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return $this->fullname;
|
return $this->fullname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +247,7 @@ class Actor extends Entity
|
|||||||
return Cache::get('actor-nickname-id-' . $id, fn () => self::getById($id)->getNickname());
|
return Cache::get('actor-nickname-id-' . $id, fn () => self::getById($id)->getNickname());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFullnameById(int $id): string
|
public static function getFullnameById(int $id): ?string
|
||||||
{
|
{
|
||||||
return Cache::get('actor-fullname-id-' . $id, fn () => self::getById($id)->getFullname());
|
return Cache::get('actor-fullname-id-' . $id, fn () => self::getById($id)->getFullname());
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ class Note extends Entity
|
|||||||
return Actor::getNicknameById($this->actor_id);
|
return Actor::getNicknameById($this->actor_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getActorFullname(): string
|
public function getActorFullname(): ?string
|
||||||
{
|
{
|
||||||
return Actor::getFullnameById($this->actor_id);
|
return Actor::getFullnameById($this->actor_id);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
{# Microformat's h-card properties indicates a face icon is a "u-logo" #}
|
{# Microformat's h-card properties indicates a face icon is a "u-logo" #}
|
||||||
<a href="{{ actor_url }}" class="note-author u-url">
|
<a href="{{ actor_url }}" class="note-author u-url">
|
||||||
<strong class="note-author-fullname">
|
<strong class="note-author-fullname">
|
||||||
{% if fullname is defined %}
|
{% if fullname is not null %}
|
||||||
{{ fullname }}
|
{{ fullname }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ nickname }}
|
{{ nickname }}
|
||||||
|
Loading…
Reference in New Issue
Block a user