Merge pull request #8366 from Wikia/DAT-3194

Dat 3194 - for videos in infobox use link to file page instead of link to original image
This commit is contained in:
Nikodem 2015-09-09 17:24:39 +02:00
commit 9767ef0d50
2 changed files with 20 additions and 4 deletions

View file

@ -110,8 +110,14 @@ class NodeImage extends Node {
* @return array * @return array
*/ */
private function videoDataDecorator( $data, $file ) { private function videoDataDecorator( $data, $file ) {
$data['isVideo'] = true; $title = $file->getTitle();
$data['duration'] = WikiaFileHelper::formatDuration( $file->getMetadataDuration());
if ( $title ) {
$data[ 'url' ] = $title->getFullURL();
}
$data[ 'isVideo' ] = true;
$data[ 'duration' ] = WikiaFileHelper::formatDuration( $file->getMetadataDuration());
return $data; return $data;
} }

View file

@ -112,12 +112,12 @@ class NodeImageTest extends WikiaBaseTest {
'<image source="img" />', '<image source="img" />',
[ 'img' => 'test.jpg' ], [ 'img' => 'test.jpg' ],
[ [
'url' => '', 'url' => 'http://test.url',
'name' => 'Test.jpg', 'name' => 'Test.jpg',
'key' => 'Test.jpg', 'key' => 'Test.jpg',
'alt' => null, 'alt' => null,
'caption' => null, 'caption' => null,
'ref' => 0, 'ref' => null,
'isVideo' => true, 'isVideo' => true,
'duration' => '00:10' 'duration' => '00:10'
] ]
@ -138,4 +138,14 @@ class FileMock {
public function getUrl() { public function getUrl() {
return ''; return '';
} }
public function getTitle() {
return new TitleMock();
}
}
class TitleMock {
public function getFullURL() {
return 'http://test.url';
}
} }