Compare commits

...

1 commit

Author SHA1 Message Date
Matt Wiebe
d7d084b875 Attachments: dedupe earlier to prevent incorrect max_media 2023-11-17 12:19:06 +01:00

View file

@ -185,7 +185,6 @@ class Post {
$blocks = \parse_blocks( $this->wp_post->post_content ); $blocks = \parse_blocks( $this->wp_post->post_content );
$media_ids = self::get_media_ids_from_blocks( $blocks, $media_ids, $max_media ); $media_ids = self::get_media_ids_from_blocks( $blocks, $media_ids, $max_media );
} }
$media_ids = \array_unique( $media_ids );
return \array_filter( \array_map( array( self::class, 'wp_attachment_to_activity_attachment' ), $media_ids ) ); return \array_filter( \array_map( array( self::class, 'wp_attachment_to_activity_attachment' ), $media_ids ) );
} }
@ -279,6 +278,9 @@ class Post {
break; break;
} }
// depupe
$media_ids = \array_unique( $media_ids );
// stop doing unneeded work // stop doing unneeded work
if ( count( $media_ids ) >= $max_media ) { if ( count( $media_ids ) >= $max_media ) {
break; break;