Attachments: dedupe earlier to prevent incorrect max_media (#565)
This commit is contained in:
parent
21206ecda0
commit
c35ddf1935
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue