mirror of
https://github.com/flarum/core.git
synced 2025-07-29 20:50:28 +02:00
31 lines
753 B
JavaScript
31 lines
753 B
JavaScript
import Component from 'flarum/Component';
|
|
import icon from 'flarum/helpers/icon';
|
|
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 title = extractText(app.trans('core.post_edited', {user: editUser, ago: humanTime(post.editTime())}));
|
|
|
|
return (
|
|
<span className="PostEdited" title={title}>{icon('pencil')}</span>
|
|
);
|
|
}
|
|
|
|
config(isInitialized) {
|
|
if (isInitialized) return;
|
|
|
|
this.$().tooltip();
|
|
}
|
|
}
|