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

posting to blue sky working #3004

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

krrish-sehgal
Copy link
Contributor

@krrish-sehgal krrish-sehgal commented Nov 28, 2024

Fixes #2955

Solution Description:

  1. An option for the user with mentor tag to approve an Activity to get posted on bluesky and it gets immediately posted.
  2. Also if the post is matching the like thresholds : like>=3 and dislikes < 3 , then it gets automatically posted
  3. New dependency : atproto = "^0.0.55" as mentioned here (https://docs.bsky.app/docs/get-started)

Implementation details :

  1. Implemented the complete like and dislike functionality.
  2. Implemented the automatic posting on blue sky flow.

Bugs:
1.Currently for photos post its showing the alt text instead of the image in blue sky even though photo is going through the endpoint.

Requirements:
In enviroment variables make sure to add:

BLUESKY_USERNAME=example.bsky.social
BLUESKY_PASSWORD='example#123'

Here's a demo of the working:

Screen.Recording.2024-11-29.at.12.43.13.AM.mov

website/views/organization.py Fixed Show fixed Hide fixed
website/views/organization.py Fixed Show fixed Hide fixed
website/views/organization.py Fixed Show fixed Hide fixed
@krrish-sehgal
Copy link
Contributor Author

@DonnieBLT sir , Please feel free to review and suggest any changes.
Thanks.

@krrish-sehgal
Copy link
Contributor Author

krrish-sehgal commented Nov 28, 2024

For the failing test case ...
Since it has a new dependency atproto = "^0.0.55", its generating a new poetry.lock.
So is it necessary for me to commit my own poetry.lock file as well or should i make changes in actions workflow and add this line "poetry lock --no-update".

@krrish-sehgal
Copy link
Contributor Author

@DonnieBLT sir , had one pending doubt here, regarding the regenertation of the lock file.
Thanks.

For the failing test case ... Since it has a new dependency atproto = "^0.0.55", its generating a new poetry.lock. So is it necessary for me to commit my own poetry.lock file as well or should i make changes in actions workflow and add this line "poetry lock --no-update".

@krrish-sehgal
Copy link
Contributor Author

@DonnieBLT sir, is this good for merge?

post_data = f"{self.title}\n\n{self.description}"
# If image exists, include it
if self.image:
print("image = " + self.image.path)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please remove the print statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure on it.

@login_required
@require_POST
def like_activity(request, id):
activity = get_object_or_404(Activity, id=id)
Copy link
Collaborator

@DonnieBLT DonnieBLT Dec 1, 2024

Choose a reason for hiding this comment

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

We have like and dislike on issues I wanted to check is there anyway that we could reuse the same models?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The like and dislike functionality for issues differs significantly from the implementation for activities:

Issue likes and dislikes are linked directly to the user profile model (issue_upvoted, issue_downvoted).
However, we don’t want to store activity likes and dislikes in a similar manner, as it would be redundant.

Currently, an email is sent to the user every time their issue is liked. Sending another email when their issue is liked via the activity feed would be redundant.
That said, we can send an email notification if their content is featured on Blue Sky.

Conclusion:
While this can be implemented, it would require many if-else conditions, making the code more complex.

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

Successfully merging this pull request may close these issues.

Post new content to blue sky
2 participants