8000 [Notifier] [Bluesky] Allow to attach website preview card by ppoulpe · Pull Request #59667 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[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

Merged
merged 1 commit into from
Feb 1, 2025

Conversation

ppoulpe
Copy link
Contributor
@ppoulpe ppoulpe commented Jan 31, 2025
Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #...
License MIT

This addition will allow us to add a preview card to a link:
image

@carsonbot
Copy link

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:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.3 branch.

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!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

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'],
Copy link
Contributor Author

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.

Copy link
Member

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?

Suggested change
'thumb' => current($uploadedMedia)['image'],
'thumb' => $uploadedMedia[array_key_first($uploadedMedia)]['image'],

Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@ppoulpe ppoulpe force-pushed the bluesky-website-card-preview branch from 31b4cae to de0c847 Compare January 31, 2025 14:47
@OskarStark OskarStark changed the title [Notifier] [Bluesky] Allow to attach website preview card [Notifier][Bluesky] Allow to attach website preview card Jan 31, 2025
@ppoulpe ppoulpe force-pushed the bluesky-website-card-preview branch 2 times, most recently from 1804405 to 72a2a2f Compare January 31, 2025 16:34
@GromNaN GromNaN requested a review from Nyholm January 31, 2025 16:43
Copy link
Member
@Nyholm Nyholm left a 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'],
Copy link
Member

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?

Suggested change
'thumb' => current($uploadedMedia)['image'],
'thumb' => $uploadedMedia[array_key_first($uploadedMedia)]['image'],

@ppoulpe ppoulpe force-pushed the bluesky-website-card-preview branch from 72a2a2f to 61a04ff Compare January 31, 2025 17:12
@ppoulpe
Copy link
Contributor Author
ppoulpe commented Jan 31, 2025

Wow, what a great feature. Thank you

I think it looks good, did you test run this to confirm we understood the protocol correctly?

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.

@carsonbot carsonbot changed the title [Notifier][Bluesky] Allow to attach website preview card [Notifier] [Bluesky] Allow to attach website preview card Jan 31, 2025
@Nyholm
Copy link
Member
Nyholm commented Jan 31, 2025

Thank you.

Let's wait for another maintainer to give their review. If they also like it they will merge it.

Copy link
Member

@fabpot fabpot left a 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?

@ppoulpe ppoulpe force-pushed the bluesky-website-card-preview branch from 61a04ff to ce977ee Compare February 1, 2025 14:17
@ppoulpe ppoulpe requested a review from fabpot February 1, 2025 14:18
// Add website preview card to the message
$options = (new BlueskyOptions())
->attachCard('https://example.com', new File('image.jpg'))
// ...
Copy link
Member
8000

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.

Copy link
Contributor Author

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.

@fabpot
Copy link
Member
fabpot commented Feb 1, 2025

Thank you @ppoulpe.

@fabpot fabpot merged commit cf015b8 into symfony:7.3 Feb 1, 2025
6 of 11 checks passed
@fabpot fabpot mentioned this pull request May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0