Fixed a bug that prevent post deletion (#23908)

* Fixed a bug that prevent post deletion

* lint fix:
Этот коммит содержится в:
Harshil Sharma
2023-06-30 10:29:27 +05:30
коммит произвёл GitHub
родитель 29466bd33a
Коммит 05cd245e97
3 изменённых файлов: 67 добавлений и 9 удалений

Просмотреть файл

@@ -218,14 +218,7 @@ export function handlePosts(state: RelationOneToOne<Post, Post> = {}, action: Ge
const newEmbeds: PostEmbed[] = [];
for (const embed of otherPost.metadata.embeds) {
if (embed.type === 'permalink' && embed.data && !('post_id' in embed.data)) {
// eslint-disable-next-line no-console
console.error('post_id missing in post embed data for permalink.');
// eslint-disable-next-line no-console
console.error(embed.data);
}
if (embed.type === 'permalink' && (embed.data as PostPreviewMetadata).post_id === post.id) {
if (embed.type === 'permalink' && embed.data && (embed.data as PostPreviewMetadata).post_id === post.id) {
// skip if the embed is the deleted post
continue;
}