mirror of
https://github.com/flarum/framework.git
synced 2024-11-22 14:41:39 +08:00
fix: post reply error
This commit is contained in:
parent
356f97641e
commit
feff1a1e7a
|
@ -111,6 +111,9 @@ class ComposerState {
|
|||
|
||||
this.position = ComposerState.Position.NORMAL;
|
||||
m.redraw.sync();
|
||||
|
||||
// Sleep for a short time to allow the composer to render before subsequent actions.
|
||||
await new Promise((resolve) => setTimeout(resolve, 80));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -159,37 +159,33 @@ const DiscussionControls = {
|
|||
* @param {boolean} goToLast Whether or not to scroll down to the last post if the discussion is being viewed.
|
||||
* @param {boolean} forceRefresh Whether or not to force a reload of the composer component, even if it is already open for this discussion.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise<ComposerState>}
|
||||
*/
|
||||
replyAction(goToLast, forceRefresh) {
|
||||
return new Promise((resolve, reject) => {
|
||||
async replyAction(goToLast, forceRefresh) {
|
||||
if (app.session.user) {
|
||||
if (this.canReply()) {
|
||||
if (!app.composer.composingReplyTo(this) || forceRefresh) {
|
||||
app.composer
|
||||
.load(() => import('../components/ReplyComposer'), {
|
||||
await app.composer.load(() => import('../components/ReplyComposer'), {
|
||||
user: app.session.user,
|
||||
discussion: this,
|
||||
})
|
||||
.then(() => app.composer.show());
|
||||
} else {
|
||||
app.composer.show();
|
||||
});
|
||||
}
|
||||
|
||||
await app.composer.show();
|
||||
|
||||
if (goToLast && app.viewingDiscussion(this) && !app.composer.isFullScreen()) {
|
||||
app.current.get('stream').goToNumber('reply');
|
||||
await app.current.get('stream').goToNumber('reply');
|
||||
}
|
||||
|
||||
return resolve(app.composer);
|
||||
return Promise.resolve(app.composer);
|
||||
} else {
|
||||
return reject();
|
||||
return Promise.reject();
|
||||
}
|
||||
}
|
||||
|
||||
app.modal.show(() => import('../components/LogInModal'));
|
||||
await app.modal.show(() => import('../components/LogInModal'));
|
||||
|
||||
return reject();
|
||||
});
|
||||
return Promise.reject();
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user