forked from GNUsocial/gnu-social
[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 {
|
||||
// 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([
|
||||
'nickname' => $sanitized_nickname,
|
||||
'outgoing_email' => $data['email'],
|
||||
|
@ -54,7 +54,7 @@ class Actor extends Entity
|
||||
// @codeCoverageIgnoreStart
|
||||
private int $id;
|
||||
private string $nickname;
|
||||
private string $fullname;
|
||||
private ?string $fullname = null;
|
||||
private int $roles = 4;
|
||||
private ?string $homepage;
|
||||
private ?string $bio;
|
||||
@ -95,8 +95,11 @@ class Actor extends Entity
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFullname(): string
|
||||
public function getFullname(): ?string
|
||||
{
|
||||
if (is_null($this->fullname)) {
|
||||
return null;
|
||||
}
|
||||
return $this->fullname;
|
||||
}
|
||||
|
||||
@ -244,7 +247,7 @@ class Actor extends Entity
|
||||
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());
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ class Note extends Entity
|
||||
return Actor::getNicknameById($this->actor_id);
|
||||
}
|
||||
|
||||
public function getActorFullname(): string
|
||||
public function getActorFullname(): ?string
|
||||
{
|
||||
return Actor::getFullnameById($this->actor_id);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@
|
||||
{# Microformat's h-card properties indicates a face icon is a "u-logo" #}
|
||||
<a href="{{ actor_url }}" class="note-author u-url">
|
||||
<strong class="note-author-fullname">
|
||||
{% if fullname is defined %}
|
||||
{% if fullname is not null %}
|
||||
{{ fullname }}
|
||||
{% else %}
|
||||
{{ nickname }}
|
||||
|
Loading…
Reference in New Issue
Block a user