Skip to content

Commit

Permalink
Ingest Pixelfed's Image attachments (#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk authored Jan 16, 2025
1 parent 6edbee4 commit 3d1f15f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion feed-parsers/class-feed-parser-activitypub.php
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ private function handle_incoming_create( $activity ) {
if ( ! isset( $attachment['type'] ) || ! isset( $attachment['mediaType'] ) ) {
continue;
}
if ( 'Document' !== $attachment['type'] ) {
if ( ! in_array( $attachment['type'], array( 'Document', 'Image' ), true ) ) {
continue;
}

Expand Down
6 changes: 6 additions & 0 deletions includes/class-feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,11 @@ public function process_incoming_feed_items( array $items, User_Feed $user_feed
if ( empty( $old_post->$field ) || empty( $post_data[ $field ] ) ) {
continue;
}
if ( 'post_content' === $field && $old_post->$field !== $post_data[ $field ] ) {
$modified_post_data[ $field ] = $post_data[ $field ];
break;
}

if ( wp_strip_all_tags( $old_post->$field ) !== wp_strip_all_tags( $post_data[ $field ] ) ) {
$modified_post_data[ $field ] = $post_data[ $field ];
break;
Expand All @@ -654,6 +659,7 @@ public function process_incoming_feed_items( array $items, User_Feed $user_feed
if ( intval( $old_post->comment_count ) !== intval( $item->comment_count ) ) {
$modified_post_data['comment_count'] = $item->comment_count;
}

wp_update_post( $modified_post_data );
$modified_posts[] = $post_id;
}
Expand Down

0 comments on commit 3d1f15f

Please sign in to comment.