1
0
mirror of https://github.com/flarum/core.git synced 2025-07-17 06:41:21 +02:00
Files
php-flarum/js/forum/src/components/PostEdited.js
Toby Zerner c05f8b732d Move details from post edited indicator back into a tooltip
Showing the username and time of edit is TMI (too much information). This commit changes the visible text to "Edited", and shows the full edit information in a tooltip.

ref #446
2016-05-21 20:27:56 +09:30

35 lines
819 B
JavaScript

import Component from 'flarum/Component';
import humanTime from 'flarum/utils/humanTime';
import extractText from 'flarum/utils/extractText';
/**
* The `PostEdited` component displays information about when and by whom a post
* was edited.
*
* ### Props
*
* - `post`
*/
export default class PostEdited extends Component {
view() {
const post = this.props.post;
const editUser = post.editUser();
const editedInfo = extractText(app.translator.trans(
'core.forum.post.edited_tooltip',
{user: editUser, ago: humanTime(post.editTime())}
));
return (
<span className="PostEdited" title={editedInfo}>
{app.translator.trans('core.forum.post.edited_text')}
</span>
);
}
config(isInitialized) {
if (isInitialized) return;
this.$().tooltip();
}
}