FreeTubeApp / FreeTube

An Open Source YouTube app for privacy
https://freetubeapp.io/
GNU Affero General Public License v3.0
13.24k stars 823 forks source link

Update subscription cache when subscribing from the channel page #5717

Closed absidue closed 1 week ago

absidue commented 1 week ago

Update subscription cache when subscribing from the channel page

Pull Request Type

Related issue

https://github.com/FreeTubeApp/FreeTube/pull/5185#pullrequestreview-2305874622

Inspired by: #4667

Description

When you visit a channel that you are already subscribed to, we update the subscription cache with the data we fetched to display on that channel. This pull request expands that to cover subscribing to a channel on the channel page too, as we already have the data we might as well add it to the cache. While this doesn't specifically help with the scenario in the video in this comment https://github.com/FreeTubeApp/FreeTube/pull/5185#pullrequestreview-2305874622 (subscribing from the search results), it does solve it for the channel page.

As YouTube doesn't provide any published dates on the shorts tab, we unfortunately cannot cache the data from that tab, however we can still cache the videos, live and community tabs.

Testing

  1. Turn off "Subscription Settings" -> "Fetch Feed Automatically"
  2. Refresh your subscriptions
  3. Subscribe to a channel that you are not subscribed to yet from the search page
  4. Visit the subscriptions page
  5. Notice that instead of showing the cached videos it says that you have turned off automatic fetching
  6. Unsubscribe from that channel from any page that is not the channel page
  7. Go back to the subscriptions page and notice that it shows the cached videos again
  8. Visit the channel page of a channel you are not subscribed to yet
  9. Subscribe to that channel from the channel page
  10. Go back to the subscriptions page
  11. It should be showing the previously cached videos as well as the videos from the channel you just subscribed to.

Desktop

PikachuEXE commented 1 week ago

As YouTube doesn't provide any published dates on the shorts tab, we unfortunately cannot cache the data from that tab, however we can still cache the videos, live and community tabs.