diff --git a/public/assets/default_theme/css/pages/feeds.css b/public/assets/default_theme/css/pages/feeds.css
index ed207c86bc..da8d32b0a8 100644
--- a/public/assets/default_theme/css/pages/feeds.css
+++ b/public/assets/default_theme/css/pages/feeds.css
@@ -154,7 +154,6 @@ embed header {
.note-author {
font-size: var(--default);
- font-weight: bold;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
@@ -170,6 +169,15 @@ embed header {
-ms-grid-row-align: center;
align-self: center
}
+.note-author-fullname {
+ font-weight: bold;
+}
+.note-author-nickname {
+ opacity: 0.5;
+}
+.note-author-nickname::before {
+ content: '@';
+}
.note-actions {
display: -webkit-box;
diff --git a/src/Controller/Security.php b/src/Controller/Security.php
index c9d5cc6d0d..a7a001ff9e 100644
--- a/src/Controller/Security.php
+++ b/src/Controller/Security.php
@@ -135,7 +135,7 @@ class Security extends Controller
try {
// This already checks if the nickname is being used
- $actor = Actor::create(['nickname' => $sanitized_nickname]);
+ $actor = Actor::create(['nickname' => $sanitized_nickname, 'fullname' => $sanitized_nickname]);
$user = LocalUser::create([
'nickname' => $sanitized_nickname,
'outgoing_email' => $data['email'],
diff --git a/src/Controller/UserPanel.php b/src/Controller/UserPanel.php
index b1791a5b25..d0bd87f43d 100644
--- a/src/Controller/UserPanel.php
+++ b/src/Controller/UserPanel.php
@@ -102,8 +102,9 @@ class UserPanel extends AbstractController
['self_tags', TextType::class, ['label' => _m('Self Tags'), 'required' => false, 'help' => _m('Tags for yourself (letters, numbers, -, ., and _), comma- or space-separated.'), 'transformer' => ArrayTransformer::class]],
['save_personal_info', SubmitType::class, ['label' => _m('Save personal info')]],
];
- $extra_step = function ($data, $extra_args) use ($user) {
+ $extra_step = function ($data, $extra_args) use ($user, $actor) {
$user->setNickname($data['nickname']);
+ if (!$data['full_name'] && !$actor->getFullname()) { $actor->setFullname($data['nickname']); }
};
return Form::handle($form_definition, $request, $actor, $extra, $extra_step, [['self_tags' => $extra['self_tags']]]);
}
diff --git a/src/Entity/Actor.php b/src/Entity/Actor.php
index 2b678950a4..d2815f0445 100644
--- a/src/Entity/Actor.php
+++ b/src/Entity/Actor.php
@@ -52,7 +52,7 @@ class Actor extends Entity
// @codeCoverageIgnoreStart
private int $id;
private string $nickname;
- private ?string $fullname;
+ private string $fullname;
private int $roles = 4;
private ?string $homepage;
private ?string $bio;
@@ -86,13 +86,13 @@ class Actor extends Entity
return $this->nickname;
}
- public function setFullname(?string $fullname): self
+ public function setFullname(string $fullname): self
{
$this->fullname = $fullname;
return $this;
}
- public function getFullname(): ?string
+ public function getFullname(): string
{
return $this->fullname;
}
@@ -234,6 +234,13 @@ class Actor extends Entity
});
}
+ public static function getFullnameById(int $id): string
+ {
+ return Cache::get('actor-fullname-id-' . $id, function () use ($id) {
+ return self::getById($id)->getFullname();
+ });
+ }
+
public function getSelfTags(bool $_test_force_recompute = false): array
{
return Cache::get('selftags-' . $this->id,
diff --git a/src/Entity/Note.php b/src/Entity/Note.php
index 3eeb444dd2..d44fc991f1 100644
--- a/src/Entity/Note.php
+++ b/src/Entity/Note.php
@@ -241,6 +241,11 @@ class Note extends Entity
return Actor::getNicknameById($this->actor_id);
}
+ public function getActorFullname(): string
+ {
+ return Actor::getFullnameById($this->actor_id);
+ }
+
public function getActorAvatarUrl(string $size = 'full'): string
{
return Avatar::getAvatarUrl($this->getActorId(), $size);
diff --git a/templates/base.html.twig b/templates/base.html.twig
index 5a9165e1a3..30d0b11327 100644
--- a/templates/base.html.twig
+++ b/templates/base.html.twig
@@ -71,7 +71,7 @@