Skip to content
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

feat(channels): Add support for Bluesky #429

Merged
merged 24 commits into from
Dec 6, 2023
Merged

Conversation

ERosendo
Copy link
Contributor

@ERosendo ERosendo commented Dec 2, 2023

This PR fixes #398.

Here's a summary of the changes introduced by this PR:

  1. Registers Bluesky as a new channel and adds a new client class to handle requests to the Bluesky API. This custom client uses the Bluesky API to handle post creation and media uploads. Although the Bluesky Python API clients listed on the website are still under development, Our class focuses on the essential functionalities required for the bot's operations.

  2. Integrate the new Bluesky API class to the Channel class properties

  3. Refines validation logic in the add-a-case form.

    While testing the Bluesky API integration, I noticed that the platform handles links differently from Mastodon and X. Unlike Mastodon/X, Bluesky uses the full length of links. This discrepancy could lead to posts exceeding the character limit of the template, as the template class doesn't truncate content in such instances. The enhancement ensures that the combined length of the post's name, summary, and link adheres to the maximum allowable length. Additionally, an informative error message is now displayed to users when the content exceeds the limit. This message instructs users to modify the content of the form, possibly by using a different combination of name, summary, and link, and resubmit it for successful posting. Here's a screenshot of the error message

image

  1. Add templates for new cases and regular posts.

@ERosendo ERosendo force-pushed the 398-add-support-for-bluesky branch 4 times, most recently from 0017035 to 53b7ce7 Compare December 3, 2023 16:03
@ERosendo ERosendo force-pushed the 398-add-support-for-bluesky branch 2 times, most recently from 6b8a625 to 5bab2df Compare December 3, 2023 18:43
@ERosendo ERosendo marked this pull request as ready for review December 3, 2023 23:20
Copy link
Member

@mlissner mlissner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. A few comments, thank you!

One question. On Blue Sky, it seems that clients are responsible for including link previews when posting (they call these "cards"), instead of the server doing that work. is that correct? If so, do we do that? Do our posts come with previews or no?

bc/core/utils/status/base.py Outdated Show resolved Hide resolved
bc/core/utils/status/base.py Outdated Show resolved Hide resolved
bc/core/utils/status/templates.py Outdated Show resolved Hide resolved
bc/core/utils/status/templates.py Outdated Show resolved Hide resolved
bc/core/utils/status/templates.py Outdated Show resolved Hide resolved
bc/core/utils/status/templates.py Outdated Show resolved Hide resolved
bc/subscription/views.py Outdated Show resolved Hide resolved
bc/subscription/views.py Show resolved Hide resolved
@ERosendo ERosendo force-pushed the 398-add-support-for-bluesky branch 2 times, most recently from f30cdf4 to b2810d8 Compare December 5, 2023 17:38
@ERosendo ERosendo force-pushed the 398-add-support-for-bluesky branch 2 times, most recently from f3709ae to 0ca1464 Compare December 6, 2023 08:30
@ERosendo
Copy link
Contributor Author

ERosendo commented Dec 6, 2023

@mlissner this PR is ready for another review. All the typos are fixed and I updated the templates to embed links within the text.

it seems that clients are responsible for including link previews when posting (they call these "cards"), instead of the server doing that work. is that correct?

You're right, the client has to extract the metadata from the link to build previews

Do our posts come with previews or no?

I added a helper method to automatically display link previews in posts when the post doesn't show thumbnails. Here are some screenshots:

Screenshot 2023-12-06 at 11 28 40 AM Screenshot 2023-12-06 at 11 28 40 AM

Copy link
Member

@mlissner mlissner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few tweaks, but otherwise looks good. Merge when ready!

@ERosendo ERosendo force-pushed the 398-add-support-for-bluesky branch 2 times, most recently from 9949652 to 81f9679 Compare December 6, 2023 21:45
@ERosendo ERosendo merged commit 83b4fac into main Dec 6, 2023
10 checks passed
@ERosendo ERosendo deleted the 398-add-support-for-bluesky branch December 6, 2023 22:05
Copy link

sentry-io bot commented Dec 8, 2023

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ Exception: image file size too large. 1000000 bytes maximum, got: 1173173 bc.subscription.tasks.make_post_for_webhook_event View Issue
  • ‼️ TypeError: Session.init() got an unexpected keyword argument 'error' bc.subscription.tasks.make_post_for_webhook_event View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Add BlueSky integration
2 participants