mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Added debug log for missing post id in embedded permalink (#23790)
* Added stricter checks for accessing other post embed data * Added debug log * Removed unused import * lint fix
This commit is contained in:
parent
2788c883b0
commit
178dbb9f95
@ -218,6 +218,13 @@ export function handlePosts(state: RelationOneToOne<Post, Post> = {}, action: Ge
|
|||||||
const newEmbeds: PostEmbed[] = [];
|
const newEmbeds: PostEmbed[] = [];
|
||||||
|
|
||||||
for (const embed of otherPost.metadata.embeds) {
|
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 as PostPreviewMetadata).post_id === post.id) {
|
||||||
// skip if the embed is the deleted post
|
// skip if the embed is the deleted post
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user