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

Add synchronization of remote featured tags #19380

Merged

Conversation

noellabo
Copy link
Contributor

Add function to sync remote account's featured tags.

Currently, the collection of featured tags is cached for 3 minutes, so if you deliver an Update activity immediately after an update, the update may fail. The load to deliver Update activity every time a featured tag is added or removed can be heavy. So, schedule it to be delivered in 3 minutes.

For updating, we can also introduce a method using the add/delete collection activity. What do you think?

@Gargron
Copy link
Member

Gargron commented Oct 18, 2022

Is it unavoidable to add a new featuredTags collection and store its URI? I remember we wanted to put the tags into the featured collection alongside pinned posts, but back then there was some compatibility issue. Still think it may be more in the spirit of ActivityPub to have these objects in the same collection.

@noellabo
Copy link
Contributor Author

I see, it would be better to put them together in a featured collection.

@noellabo noellabo force-pushed the add-synchronization-of-remote-featured-tags branch from 9b22ce8 to e3382f2 Compare October 18, 2022 09:45
@noellabo
Copy link
Contributor Author

Changed featured_tags_collection_url so that it is used on a ad-hoc basis instead of being stored in the database.
No more database migration is needed.

Add support for cases where the featured collection contains both Note and Hashtag.

However, in versions prior to Mastodon v3.5.1, an exception occurs, so feature collections containing both notes and hashtags are not read correctly.
see: #17964, #11595

For the time being, you should continue to use the featured tags collection.
We should also provide patches to other ActivityPub implementations in advance to solve the federated issues.

@Gargron
Copy link
Member

Gargron commented Oct 18, 2022

I am so sorry. I forgot I made featuredTags back in 2020.

@noellabo noellabo marked this pull request as ready for review October 19, 2022 23:07
@noellabo
Copy link
Contributor Author

noellabo commented Oct 20, 2022

This pull request will make the following changes

  • Fetch and sync featured tags from featuredTags when processing remote accounts
  • Deliver Update activity for actors when adding or removing featured tags
    • The collection response is set to cache for 3 minutes. To avoid this effect, the delivery is delayed by 3 minutes.
  • (Update: Deliver Add / Remove activity when adding or removing featured tags.)
  • In the future, when the collection provided in the featured contains both Note and Hashtag (status and featured tag), we will be able to handle this
  • The response of the instance API will now contain the status and featured tags. return the maximum number of featured tags in the instance API response
configuration: {
  accounts: {
    max_featured_tags: 10
  },
},

@Gargron Gargron merged commit b0e3f03 into mastodon:main Oct 20, 2022
@ykzts
Copy link
Sponsor Member

ykzts commented Oct 20, 2022

If CircleCI is enabled in the forked repository, I cannot check the results from the Checks tab of the Pull Request. We need to check the results in the CircleCI web UI of the forked repository.

ykzts added a commit that referenced this pull request Oct 21, 2022
Gargron pushed a commit that referenced this pull request Oct 21, 2022
@noellabo
Copy link
Contributor Author

Okay, I see why. Thank you!

@noellabo noellabo deleted the add-synchronization-of-remote-featured-tags branch October 23, 2022 06:28
kadoshita pushed a commit to kadoshita/mastodon that referenced this pull request Nov 19, 2022
* Add LIMIT of featured tag to instance API response

* Add featured_tags_collection_url to Account

* Add synchronization of remote featured tags

* Deliver update activity when updating featured tag

* Remove featured_tags_collection_url

* Revert "Add featured_tags_collection_url to Account"

This reverts commit cff349f.

* Add hashtag sync from featured collections

* Fix tag name normalize

* Add target option to fetch featured collection

* Refactor fetch_featured_tags_collection_service

* Add LIMIT of featured tag to v1/instance API response
kadoshita pushed a commit to kadoshita/mastodon that referenced this pull request Nov 19, 2022
nametoolong pushed a commit to nametoolong/nuage that referenced this pull request Nov 20, 2022
* Add LIMIT of featured tag to instance API response

* Add featured_tags_collection_url to Account

* Add synchronization of remote featured tags

* Deliver update activity when updating featured tag

* Remove featured_tags_collection_url

* Revert "Add featured_tags_collection_url to Account"

This reverts commit cff349f.

* Add hashtag sync from featured collections

* Fix tag name normalize

* Add target option to fetch featured collection

* Refactor fetch_featured_tags_collection_service

* Add LIMIT of featured tag to v1/instance API response
nametoolong pushed a commit to nametoolong/nuage that referenced this pull request Nov 20, 2022
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.

None yet

3 participants