Skip to content

Commit

Permalink
Replace username with display name in more places (#3040)
Browse files Browse the repository at this point in the history
* Replace username with display name in more places

* More readable spread operator and translator user magic
  • Loading branch information
clarkwinkelmann authored Aug 21, 2021
1 parent af89b23 commit aba6836
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions js/src/forum/utils/UserControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,18 @@ export default {
* @param {string} type
*/
showDeletionAlert(user, type) {
const { username, email } = user.data.attributes;
const message = {
success: 'core.forum.user_controls.delete_success_message',
error: 'core.forum.user_controls.delete_error_message',
}[type];

app.alerts.show({ type }, app.translator.trans(message, { username, email }));
app.alerts.show(
{ type },
app.translator.trans(message, {
user,
email: user.email(),
})
);
},

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Notification/NotificationMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function send(MailableInterface $blueprint, User $user)
$blueprint->getEmailView(),
compact('blueprint', 'user'),
function (Message $message) use ($blueprint, $user) {
$message->to($user->email, $user->username)
$message->to($user->email, $user->display_name)
->subject($blueprint->getEmailSubject($this->translator));
}
);
Expand Down
2 changes: 1 addition & 1 deletion views/frontend/content/discussion.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@foreach ($posts as $post)
<div>
<?php $user = ! empty($post->relationships->user->data) ? $getResource($post->relationships->user->data) : null; ?>
<h3>{{ $user ? $user->attributes->username : $translator->trans('core.lib.username.deleted_text') }}</h3>
<h3>{{ $user ? $user->attributes->displayName : $translator->trans('core.lib.username.deleted_text') }}</h3>
<div class="Post-body">
{!! $post->attributes->contentHtml !!}
</div>
Expand Down

0 comments on commit aba6836

Please sign in to comment.