Skip to content

Commit

Permalink
Fix Original image meta for Unsplash modal
Browse files Browse the repository at this point in the history
  • Loading branch information
ravichdev committed Jul 9, 2020
1 parent 33672ab commit f91e6b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
5 changes: 3 additions & 2 deletions php/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -907,12 +907,13 @@ public function add_media_templates() { ?>
</div>
<# } #>
<# var originalImageURL = data.originalImageURL || data.link; #>
<# if ( data.originalUnsplashImageURL && data.originalUnsplashImageName ) { #>
<strong><?php esc_html_e( 'Original image:' ); ?></strong>
<a href="{{ data.originalUnsplashImageURL }}">{{data.originalUnsplashImageName}}</a>
<# } else if ( data.originalImageURL && data.originalImageName ) { #>
<# } else if ( originalImageURL ) { #>
<strong><?php esc_html_e( 'Original image:' ); ?></strong>
<a href="{{ data.originalImageURL }}">{{data.originalImageName}}</a>
<a href="{{ originalImageURL }}"><?php esc_html_e( 'Unsplash', 'unsplash' ); ?></a>
<# } #>
<# if ( data.can.save && data.sizes ) { #>
Expand Down
12 changes: 3 additions & 9 deletions tests/phpunit/php/class-test-hotlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -772,10 +772,7 @@ public function test_no_attachment_submitbox_misc_actions() {
]
);
$post = get_post( $second_id );

ob_start();
$this->hotlink->attachment_submitbox_misc_actions();
$content = ob_get_clean();
$content = get_echo( [ $this->hotlink, 'attachment_submitbox_misc_actions' ] );

$this->assertEmpty( $content );
}
Expand All @@ -787,11 +784,8 @@ public function test_no_attachment_submitbox_misc_actions() {
*/
public function test_attachment_submitbox_misc_actions() {
global $post;
$post = get_post( self::$attachment_id );

ob_start();
$this->hotlink->attachment_submitbox_misc_actions();
$content = ob_get_clean();
$post = get_post( self::$attachment_id );
$content = get_echo( [ $this->hotlink, 'attachment_submitbox_misc_actions' ] );

$this->assertNotEmpty( $content );
$this->assertContains( 'misc-pub-original-unsplash-image', $content );
Expand Down

0 comments on commit f91e6b3

Please sign in to comment.