Skip to content

Commit

Permalink
Merge pull request #203 from j0k3r/fix/giphy-image-url
Browse files Browse the repository at this point in the history
Fix Giphy image/url parameter
  • Loading branch information
j0k3r authored Feb 5, 2019
2 parents dd212fe + 9ea82ea commit ca3f6ba
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 53 deletions.
90 changes: 45 additions & 45 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/AppBundle/Extractor/Giphy.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ public function getContent()
return '';
}

return '<div><h2>' . $data['title'] . '</h2><p><img src="' . $data['image'] . '"></p></div>';
return '<div><h2>' . $data['title'] . '</h2><p><img src="' . $data['url'] . '"></p></div>';
}
}
26 changes: 21 additions & 5 deletions src/AppBundle/Form/Type/FeedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,27 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', TextType::class)
->add('description', TextareaType::class, ['required' => false])
->add('host', TextType::class, ['attr' => ['placeholder' => 'www.website.com']])
->add('link', UrlType::class, ['attr' => ['placeholder' => 'http://www.website.com/rss']])
->add('logo', UrlType::class, ['required' => false])
->add('color', TextType::class, ['required' => false])
->add('description', TextareaType::class, [
'required' => false,
])
->add('host', TextType::class, [
'attr' => [
'placeholder' => 'www.website.com',
],
])
->add('link', UrlType::class, [
'default_protocol' => null,
'attr' => [
'placeholder' => 'http://www.website.com/rss',
],
])
->add('logo', UrlType::class, [
'default_protocol' => null,
'required' => false,
])
->add('color', TextType::class, [
'required' => false,
])
->add('parser', ChoiceType::class, [
'choices' => [
'Internal' => 'internal',
Expand Down
5 changes: 4 additions & 1 deletion src/AppBundle/Form/Type/ItemTestType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('link', UrlType::class, [
'default_protocol' => null,
'constraints' => new Url(),
])
->add('siteconfig', TextareaType::class, ['required' => false])
->add('siteconfig', TextareaType::class, [
'required' => false,
])
->add('parser', ChoiceType::class, [
'choices' => array_flip([
'internal' => 'Internal',
Expand Down
2 changes: 1 addition & 1 deletion tests/AppBundle/Extractor/GiphyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testContent()
$client = new Client();

$mock = new Mock([
new Response(200, [], Stream::factory(json_encode(['title' => 'my title', 'image' => 'http://0.0.0.0/img.jpg']))),
new Response(200, [], Stream::factory(json_encode(['title' => 'my title', 'url' => 'http://0.0.0.0/img.jpg']))),
new Response(200, [], Stream::factory(json_encode(''))),
new Response(400, [], Stream::factory(json_encode('oops'))),
]);
Expand Down

0 comments on commit ca3f6ba

Please sign in to comment.