mirror of
https://github.com/flarum/framework.git
synced 2025-03-01 20:53:27 +08:00
Fix PostEdited tooltip not updating
This commit is contained in:
parent
dc21bbb743
commit
4c3ebe2538
17
framework/core/js/forum/dist/app.js
vendored
17
framework/core/js/forum/dist/app.js
vendored
@ -24355,11 +24355,21 @@ System.register('flarum/components/PostEdited', ['flarum/Component', 'flarum/uti
|
||||
}
|
||||
|
||||
babelHelpers.createClass(PostEdited, [{
|
||||
key: 'init',
|
||||
value: function init() {
|
||||
this.shouldUpdateTooltip = false;
|
||||
this.oldEditedInfo = null;
|
||||
}
|
||||
}, {
|
||||
key: 'view',
|
||||
value: function view() {
|
||||
var post = this.props.post;
|
||||
var editUser = post.editUser();
|
||||
var editedInfo = extractText(app.translator.trans('core.forum.post.edited_tooltip', { user: editUser, ago: humanTime(post.editTime()) }));
|
||||
if (editedInfo !== this.oldEditedInfo) {
|
||||
this.shouldUpdateTooltip = true;
|
||||
this.oldEditedInfo = editedInfo;
|
||||
}
|
||||
|
||||
return m(
|
||||
'span',
|
||||
@ -24370,9 +24380,10 @@ System.register('flarum/components/PostEdited', ['flarum/Component', 'flarum/uti
|
||||
}, {
|
||||
key: 'config',
|
||||
value: function config(isInitialized) {
|
||||
if (isInitialized) return;
|
||||
|
||||
this.$().tooltip();
|
||||
if (this.shouldUpdateTooltip) {
|
||||
this.$().tooltip('destroy').tooltip();
|
||||
this.shouldUpdateTooltip = false;
|
||||
}
|
||||
}
|
||||
}]);
|
||||
return PostEdited;
|
||||
|
@ -11,6 +11,11 @@ import extractText from 'flarum/utils/extractText';
|
||||
* - `post`
|
||||
*/
|
||||
export default class PostEdited extends Component {
|
||||
init() {
|
||||
this.shouldUpdateTooltip = false;
|
||||
this.oldEditedInfo = null;
|
||||
}
|
||||
|
||||
view() {
|
||||
const post = this.props.post;
|
||||
const editUser = post.editUser();
|
||||
@ -18,6 +23,10 @@ export default class PostEdited extends Component {
|
||||
'core.forum.post.edited_tooltip',
|
||||
{user: editUser, ago: humanTime(post.editTime())}
|
||||
));
|
||||
if (editedInfo !== this.oldEditedInfo) {
|
||||
this.shouldUpdateTooltip = true;
|
||||
this.oldEditedInfo = editedInfo;
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="PostEdited" title={editedInfo}>
|
||||
@ -27,8 +36,9 @@ export default class PostEdited extends Component {
|
||||
}
|
||||
|
||||
config(isInitialized) {
|
||||
if (isInitialized) return;
|
||||
|
||||
this.$().tooltip();
|
||||
if (this.shouldUpdateTooltip) {
|
||||
this.$().tooltip('destroy').tooltip();
|
||||
this.shouldUpdateTooltip = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user