mirror of
https://github.com/flarum/core.git
synced 2025-08-04 15:37:51 +02:00
feat: expose {time} to eventPost data, fix renamed tooltip (#3698)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import app from '../../forum/app';
|
||||
import EventPost from './EventPost';
|
||||
import extractText from '../../common/utils/extractText';
|
||||
import Tooltip from '../../common/components/Tooltip';
|
||||
|
||||
/**
|
||||
* The `DiscussionRenamedPost` component displays a discussion event post
|
||||
@@ -17,9 +18,8 @@ export default class DiscussionRenamedPost extends EventPost {
|
||||
|
||||
description(data) {
|
||||
const renamed = app.translator.trans('core.forum.post_stream.discussion_renamed_text', data);
|
||||
const oldName = app.translator.trans('core.forum.post_stream.discussion_renamed_old_tooltip', data);
|
||||
|
||||
return <span title={extractText(oldName)}>{renamed}</span>;
|
||||
return <span>{renamed}</span>;
|
||||
}
|
||||
|
||||
descriptionData() {
|
||||
@@ -28,8 +28,11 @@ export default class DiscussionRenamedPost extends EventPost {
|
||||
const newTitle = post.content()[1];
|
||||
|
||||
return {
|
||||
old: oldTitle,
|
||||
new: <strong className="DiscussionRenamedPost-new">{newTitle}</strong>,
|
||||
new: (
|
||||
<Tooltip text={extractText(app.translator.trans('core.forum.post_stream.discussion_renamed_old_tooltip', { old: oldTitle }))}>
|
||||
<strong className="DiscussionRenamedPost-new">{newTitle}</strong>
|
||||
</Tooltip>
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import { ucfirst } from '../../common/utils/string';
|
||||
import usernameHelper from '../../common/helpers/username';
|
||||
import icon from '../../common/helpers/icon';
|
||||
import Link from '../../common/components/Link';
|
||||
import humanTime from '../../common/helpers/humanTime';
|
||||
|
||||
/**
|
||||
* The `EventPost` component displays a post which indicating a discussion
|
||||
@@ -37,6 +38,7 @@ export default class EventPost extends Post {
|
||||
) : (
|
||||
username
|
||||
),
|
||||
time: humanTime(this.attrs.post.createdAt()),
|
||||
});
|
||||
|
||||
return super.content().concat([icon(this.icon(), { className: 'EventPost-icon' }), <div class="EventPost-info">{this.description(data)}</div>]);
|
||||
|
@@ -446,7 +446,7 @@ core:
|
||||
# These translations are displayed between posts in the post stream.
|
||||
post_stream:
|
||||
discussion_renamed_old_tooltip: 'The old title was: "{old}"'
|
||||
discussion_renamed_text: "{username} changed the title to {new}."
|
||||
discussion_renamed_text: "{username} changed the title to {new} {time}."
|
||||
load_more_button: => core.ref.load_more
|
||||
reply_placeholder: => core.ref.write_a_reply
|
||||
time_lapsed_text: "{period} later"
|
||||
|
Reference in New Issue
Block a user