-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Notifier] [Bluesky] Allow to attach website preview card #59667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
'uri' => $options['external']['uri'], | ||
'title' => $options['external']['title'], | ||
'description' => $options['external']['description'], | ||
'thumb' => current($uploadedMedia)['image'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We reuse the same method as for adding media, but we can only use one image in our case, so we take the first image that comes along.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid current()
and take the first one instead?
'thumb' => current($uploadedMedia)['image'], | |
'thumb' => $uploadedMedia[array_key_first($uploadedMedia)]['image'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
@@ -274,9 +274,12 @@ public function testParseFacetsUrlWithTrickyRegex() | |||
$this->assertEquals($expected, $this->parseFacets($input)); | |||
} | |||
|
|||
public function testWithMedia() | |||
/** | |||
* @dataProvider sendMessageWithEmbedDataProvider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using dataProvider to add website card preview to previous test.
31b4cae
to
de0c847
Compare
src/Symfony/Component/Notifier/Bridge/Bluesky/BlueskyTransport.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Notifier/Bridge/Bluesky/BlueskyTransport.php
Outdated
Show resolved
Hide resolved
1804405
to
72a2a2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, what a great feature. Thank you
I think it looks good, did you test run this to confirm we understood the protocol correctly?
'uri' => $options['external']['uri'], | ||
'title' => $options['external']['title'], | ||
'description' => $options['external']['description'], | ||
'thumb' => current($uploadedMedia)['image'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid current()
and take the first one instead?
'thumb' => current($uploadedMedia)['image'], | |
'thumb' => $uploadedMedia[array_key_first($uploadedMedia)]['image'], |
72a2a2f
to
61a04ff
Compare
Hello and thanks for your positive feedback :) I actually tested the code to make sure it was OK on the Bluesky side, and the screenshot in the commentary is from the test in question. |
Thank you. Let's wait for another maintainer to give their review. If they also like it they will merge it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a note about how touse this feature in the README file of the bridge?
61a04ff
to
ce977ee
Compare
// Add website preview card to the message | ||
$options = (new BlueskyOptions()) | ||
->attachCard('https://example.com', new File('image.jpg')) | ||
// ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also describe attachMedia()
as this the only other possible option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the method and commented on it, as it's not possible to use both of them at the same time.
ce977ee
to
15ded98
Compare
Thank you @ppoulpe. |
This addition will allow us to add a preview card to a link:
