fix: post reply error

This commit is contained in:
Sami Mazouz 2024-10-19 11:55:05 +01:00
parent 356f97641e
commit feff1a1e7a
No known key found for this signature in database
2 changed files with 25 additions and 26 deletions

View File

@ -111,6 +111,9 @@ class ComposerState {
this.position = ComposerState.Position.NORMAL; this.position = ComposerState.Position.NORMAL;
m.redraw.sync(); m.redraw.sync();
// Sleep for a short time to allow the composer to render before subsequent actions.
await new Promise((resolve) => setTimeout(resolve, 80));
} }
/** /**

View File

@ -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} 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. * @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) { async replyAction(goToLast, forceRefresh) {
return new Promise((resolve, reject) => { if (app.session.user) {
if (app.session.user) { if (this.canReply()) {
if (this.canReply()) { if (!app.composer.composingReplyTo(this) || forceRefresh) {
if (!app.composer.composingReplyTo(this) || forceRefresh) { await app.composer.load(() => import('../components/ReplyComposer'), {
app.composer user: app.session.user,
.load(() => import('../components/ReplyComposer'), { discussion: this,
user: app.session.user, });
discussion: this,
})
.then(() => app.composer.show());
} else {
app.composer.show();
}
if (goToLast && app.viewingDiscussion(this) && !app.composer.isFullScreen()) {
app.current.get('stream').goToNumber('reply');
}
return resolve(app.composer);
} else {
return reject();
} }
await app.composer.show();
if (goToLast && app.viewingDiscussion(this) && !app.composer.isFullScreen()) {
await app.current.get('stream').goToNumber('reply');
}
return Promise.resolve(app.composer);
} else {
return Promise.reject();
} }
}
app.modal.show(() => import('../components/LogInModal')); await app.modal.show(() => import('../components/LogInModal'));
return reject(); return Promise.reject();
});
}, },
/** /**