FIX: error when opening a previously deleted post (#19346)

The repro for the bug:

Add a post with a mention of a user
Post another post below
Delete the first post with a mention
Reload the page and try to attempt to view hidden reply
This commit is contained in:
Andrei Prigorshnev 2022-12-06 23:49:34 +04:00 committed by GitHub
parent b341f75400
commit 26a45e8166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -396,6 +396,7 @@ export default RestModel.extend({
if (postIdx !== -1) {
return this.findPostsByIds(headGap).then((posts) => {
posts.forEach((p) => {
this._initUserModels(p);
const stored = this.storePost(p);
if (!currentPosts.includes(stored)) {
currentPosts.insertAt(postIdx++, stored);

View File

@ -69,7 +69,7 @@ export default class PostCooked {
this._insertQuoteControls(cookedDiv);
this._showLinkCounts(cookedDiv);
this._applySearchHighlight(cookedDiv);
this._initUserStatusToMentions();
this._initUserStatusOnMentions();
this._decorateAndAdopt(cookedDiv);
return cookedDiv;
@ -374,7 +374,7 @@ export default class PostCooked {
return cookedDiv;
}
_initUserStatusToMentions() {
_initUserStatusOnMentions() {
if (!this._isInComposerPreview) {
this._trackMentionedUsersStatus();
this._rerenderUserStatusOnMentions();