mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 00:43:54 +08:00
Replace username with display name in more places (#3040)
* Replace username with display name in more places * More readable spread operator and translator user magic
This commit is contained in:
parent
af89b23f67
commit
aba6836bdd
|
@ -124,13 +124,18 @@ export default {
|
||||||
* @param {string} type
|
* @param {string} type
|
||||||
*/
|
*/
|
||||||
showDeletionAlert(user, type) {
|
showDeletionAlert(user, type) {
|
||||||
const { username, email } = user.data.attributes;
|
|
||||||
const message = {
|
const message = {
|
||||||
success: 'core.forum.user_controls.delete_success_message',
|
success: 'core.forum.user_controls.delete_success_message',
|
||||||
error: 'core.forum.user_controls.delete_error_message',
|
error: 'core.forum.user_controls.delete_error_message',
|
||||||
}[type];
|
}[type];
|
||||||
|
|
||||||
app.alerts.show({ type }, app.translator.trans(message, { username, email }));
|
app.alerts.show(
|
||||||
|
{ type },
|
||||||
|
app.translator.trans(message, {
|
||||||
|
user,
|
||||||
|
email: user.email(),
|
||||||
|
})
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -46,7 +46,7 @@ class NotificationMailer
|
||||||
$blueprint->getEmailView(),
|
$blueprint->getEmailView(),
|
||||||
compact('blueprint', 'user'),
|
compact('blueprint', 'user'),
|
||||||
function (Message $message) use ($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));
|
->subject($blueprint->getEmailSubject($this->translator));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
@foreach ($posts as $post)
|
@foreach ($posts as $post)
|
||||||
<div>
|
<div>
|
||||||
<?php $user = ! empty($post->relationships->user->data) ? $getResource($post->relationships->user->data) : null; ?>
|
<?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">
|
<div class="Post-body">
|
||||||
{!! $post->attributes->contentHtml !!}
|
{!! $post->attributes->contentHtml !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user