From a6b59889f6a6bca8e224e42f1cc2a0b011993a4b Mon Sep 17 00:00:00 2001
From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Date: Sat, 26 Aug 2023 08:42:32 -0700
Subject: [PATCH 1/9] Add subscription community tab
---
.../distraction-settings.vue | 6 +
.../subscriptions-community.js | 228 ++++++++++++++++++
.../subscriptions-community.vue | 12 +
.../subscriptions-tab-ui.js | 4 +
.../subscriptions-tab-ui.vue | 1 +
src/renderer/helpers/api/local.js | 30 +++
src/renderer/store/modules/settings.js | 1 +
src/renderer/store/modules/subscriptions.js | 25 +-
.../views/Subscriptions/Subscriptions.js | 9 +
.../views/Subscriptions/Subscriptions.vue | 21 ++
static/locales/en-US.yaml | 1 +
11 files changed, 337 insertions(+), 1 deletion(-)
create mode 100644 src/renderer/components/subscriptions-community/subscriptions-community.js
create mode 100644 src/renderer/components/subscriptions-community/subscriptions-community.vue
diff --git a/src/renderer/components/distraction-settings/distraction-settings.vue b/src/renderer/components/distraction-settings/distraction-settings.vue
index dc1af66a7663e..9fb26fc62a66a 100644
--- a/src/renderer/components/distraction-settings/distraction-settings.vue
+++ b/src/renderer/components/distraction-settings/distraction-settings.vue
@@ -66,6 +66,12 @@
:tooltip="hideLiveStreams ? hideSubscriptionsLiveTooltip : ''"
v-on="!hideLiveStreams ? { change: updateHideSubscriptionsLive } : {}"
/>
+
{{ $t("Subscriptions.All Subscription Tabs Hidden", {
subsection: $t('Settings.Distraction Free Settings.Sections.Subscriptions Page'),
diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml
index 69461b8a937dc..41325633b26b8 100644
--- a/static/locales/en-US.yaml
+++ b/static/locales/en-US.yaml
@@ -45,6 +45,7 @@ Global:
Videos: Videos
Shorts: Shorts
Live: Live
+ Community: Community
# Search Bar
Search / Go to URL: Search / Go to URL
From 446688ae98a102178d5a21a2d0f261d1b2425aef Mon Sep 17 00:00:00 2001
From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Date: Tue, 29 Aug 2023 09:03:26 -0700
Subject: [PATCH 2/9] fix up community tab
---
.../distraction-settings.js | 6 +-
.../ft-community-post/ft-community-post.js | 2 +
.../ft-community-post/ft-community-post.scss | 6 ++
.../ft-community-post/ft-community-post.vue | 27 +++++++-
.../subscriptions-community.js | 61 ++++++++-----------
.../subscriptions-community.vue | 2 +-
.../views/Subscriptions/Subscriptions.js | 9 ++-
static/locales/en-US.yaml | 1 +
8 files changed, 75 insertions(+), 39 deletions(-)
diff --git a/src/renderer/components/distraction-settings/distraction-settings.js b/src/renderer/components/distraction-settings/distraction-settings.js
index ea67fe25bd60b..b7d41dfdf5494 100644
--- a/src/renderer/components/distraction-settings/distraction-settings.js
+++ b/src/renderer/components/distraction-settings/distraction-settings.js
@@ -89,6 +89,9 @@ export default defineComponent({
hideSubscriptionsLive: function() {
return this.$store.getters.getHideSubscriptionsLive
},
+ hideSubscriptionsCommunity: function() {
+ return this.$store.getters.getHideSubscriptionsCommunity
+ },
showDistractionFreeTitles: function () {
return this.$store.getters.getShowDistractionFreeTitles
},
@@ -144,7 +147,8 @@ export default defineComponent({
'updateHideChannelReleases',
'updateHideSubscriptionsVideos',
'updateHideSubscriptionsShorts',
- 'updateHideSubscriptionsLive'
+ 'updateHideSubscriptionsLive',
+ 'updateHideSubscriptionsCommunity'
])
}
})
diff --git a/src/renderer/components/ft-community-post/ft-community-post.js b/src/renderer/components/ft-community-post/ft-community-post.js
index a7086c2953bb4..2d98438f1ace8 100644
--- a/src/renderer/components/ft-community-post/ft-community-post.js
+++ b/src/renderer/components/ft-community-post/ft-community-post.js
@@ -40,6 +40,7 @@ export default defineComponent({
commentCount: '',
isLoading: true,
author: '',
+ authorId: '',
}
},
computed: {
@@ -104,6 +105,7 @@ export default defineComponent({
this.commentCount = this.data.commentCount
this.type = (this.data.postContent !== null && this.data.postContent !== undefined) ? this.data.postContent.type : 'text'
this.author = this.data.author
+ this.authorId = this.data.authorId
this.isLoading = false
},
diff --git a/src/renderer/components/ft-community-post/ft-community-post.scss b/src/renderer/components/ft-community-post/ft-community-post.scss
index ad3cf1c875022..b71950185dad3 100644
--- a/src/renderer/components/ft-community-post/ft-community-post.scss
+++ b/src/renderer/components/ft-community-post/ft-community-post.scss
@@ -4,6 +4,7 @@
.outside {
margin: auto;
width: 40%;
+
@media screen and (max-width: 768px) {
width: 100%;
}
@@ -33,6 +34,11 @@
font-size: 15px;
font-weight: bold;
margin: 5px 6px 0 5px;
+
+ .authorNameLink {
+ color: inherit;
+ text-decoration: none;
+ }
}
.publishedText {
diff --git a/src/renderer/components/ft-community-post/ft-community-post.vue b/src/renderer/components/ft-community-post/ft-community-post.vue
index 870a66807e553..74f382407edab 100644
--- a/src/renderer/components/ft-community-post/ft-community-post.vue
+++ b/src/renderer/components/ft-community-post/ft-community-post.vue
@@ -8,8 +8,20 @@
+
+
+
- {{ author }}
+
+ {{ author }}
+
+
+ {{ author }}
+
{
- return cacheEntry.videos != null
+ return cacheEntry.posts != null
})
},
@@ -73,16 +69,16 @@ export default defineComponent({
watch: {
activeProfile: async function (_) {
this.isLoading = true
- this.loadVideosFromCacheSometimes()
+ this.loadpostsFromCacheSometimes()
},
},
mounted: async function () {
this.isLoading = true
- this.loadVideosFromCacheSometimes()
+ this.loadpostsFromCacheSometimes()
},
methods: {
- loadVideosFromCacheSometimes() {
+ loadpostsFromCacheSometimes() {
// This method is called on view visible
if (this.postCacheForAllActiveProfileChannelsPresent) {
this.loadPostsFromCacheForAllActiveProfileChannels()
@@ -93,52 +89,44 @@ export default defineComponent({
},
async loadPostsFromCacheForAllActiveProfileChannels() {
- const videoList = []
+ const postList = []
this.activeSubscriptionList.forEach((channel) => {
const channelCacheEntry = this.$store.getters.getPostsCacheByChannel(channel.id)
- videoList.push(...channelCacheEntry.videos)
+ postList.push(...channelCacheEntry.posts)
})
- videoList.sort((a, b) => {
+ postList.sort((a, b) => {
return calculatePublishedDate(b.publishedText) - calculatePublishedDate(a.publishedText)
})
- this.videoList = videoList
+ this.postList = postList
this.isLoading = false
},
loadPostsForSubscriptionsFromRemote: async function () {
if (this.activeSubscriptionList.length === 0) {
this.isLoading = false
- this.videoList = []
+ this.postList = []
return
}
const channelsToLoadFromRemote = this.activeSubscriptionList
- const videoList = []
+ const postList = []
let channelCount = 0
this.isLoading = true
- let useRss = this.useRssFeeds
- if (channelsToLoadFromRemote.length >= 125 && !useRss) {
- showToast(
- this.$t('Subscriptions["This profile has a large number of subscriptions. Forcing RSS to avoid rate limiting"]'),
- 10000
- )
- useRss = true
- }
this.updateShowProgressBar(true)
this.setProgressBarPercentage(0)
this.attemptedFetch = true
this.errorChannels = []
- const videoListFromRemote = (await Promise.all(channelsToLoadFromRemote.map(async (channel) => {
- let videos = []
+ const postListFromRemote = (await Promise.all(channelsToLoadFromRemote.map(async (channel) => {
+ let posts = []
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
- videos = await this.getChannelPostsInvidious(channel)
+ posts = await this.getChannelPostsInvidious(channel)
} else {
- videos = await this.getChannelPostsLocal(channel)
+ posts = await this.getChannelPostsLocal(channel)
}
channelCount++
@@ -147,16 +135,16 @@ export default defineComponent({
this.updateSubscriptionPostsCacheByChannel({
channelId: channel.id,
- videos: videos,
+ posts: posts,
})
- return videos
+ return posts
}))).flatMap((o) => o)
- videoList.push(...videoListFromRemote)
- videoList.sort((a, b) => {
+ postList.push(...postListFromRemote)
+ postList.sort((a, b) => {
return calculatePublishedDate(b.publishedText) - calculatePublishedDate(a.publishedText)
})
- this.videoList = videoList
+ this.postList = postList
this.isLoading = false
this.updateShowProgressBar(false)
},
@@ -166,7 +154,7 @@ export default defineComponent({
// `this.isLoading = false` is called inside `loadPostsForSubscriptionsFromRemote` when needed
await this.loadPostsForSubscriptionsFromRemote()
} else {
- this.videoList = []
+ this.postList = []
this.attemptedFetch = false
this.isLoading = false
}
@@ -180,7 +168,9 @@ export default defineComponent({
this.errorChannels.push(channel)
return []
}
-
+ entries.forEach(post => {
+ post.authorId = channel.id
+ })
return entries
} catch (err) {
console.error(err)
@@ -199,6 +189,9 @@ export default defineComponent({
getChannelPostsInvidious: function (channel) {
return new Promise((resolve, reject) => {
invidiousGetCommunityPosts(channel.id).then(result => {
+ result.posts.forEach(post => {
+ post.authorId = channel.id
+ })
resolve(result.posts)
}).catch((err) => {
console.error(err)
diff --git a/src/renderer/components/subscriptions-community/subscriptions-community.vue b/src/renderer/components/subscriptions-community/subscriptions-community.vue
index dd2f728d92af3..c7d19dc7a2937 100644
--- a/src/renderer/components/subscriptions-community/subscriptions-community.vue
+++ b/src/renderer/components/subscriptions-community/subscriptions-community.vue
@@ -1,7 +1,7 @@
Date: Tue, 29 Aug 2023 17:21:23 -0700
Subject: [PATCH 3/9] simplify if statement
---
.../ft-community-post/ft-community-post.vue | 28 +++++++++++--------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/renderer/components/ft-community-post/ft-community-post.vue b/src/renderer/components/ft-community-post/ft-community-post.vue
index 74f382407edab..986591cf6f23c 100644
--- a/src/renderer/components/ft-community-post/ft-community-post.vue
+++ b/src/renderer/components/ft-community-post/ft-community-post.vue
@@ -8,24 +8,28 @@
-
+
+
+
-
-
+
From 5b4475d9a832bca2ee7edb8134f67d014fd9f41f Mon Sep 17 00:00:00 2001
From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Date: Tue, 29 Aug 2023 17:22:10 -0700
Subject: [PATCH 4/9] use global.community for all references to community
---
src/renderer/views/Channel/Channel.vue | 2 +-
static/locales/ar.yaml | 2 +-
static/locales/bg.yaml | 2 +-
static/locales/cs.yaml | 2 +-
static/locales/de-DE.yaml | 2 +-
static/locales/el.yaml | 2 +-
static/locales/en-US.yaml | 1 -
static/locales/en_GB.yaml | 2 +-
static/locales/eo.yaml | 5 +++--
static/locales/es.yaml | 2 +-
static/locales/et.yaml | 2 +-
static/locales/fi.yaml | 2 +-
static/locales/fr-FR.yaml | 2 +-
static/locales/gl.yaml | 2 +-
static/locales/he.yaml | 2 +-
static/locales/hr.yaml | 2 +-
static/locales/hu.yaml | 2 +-
static/locales/is.yaml | 2 +-
static/locales/it.yaml | 2 +-
static/locales/ja.yaml | 6 +++---
static/locales/nb_NO.yaml | 2 +-
static/locales/pl.yaml | 2 +-
static/locales/pt-BR.yaml | 2 +-
static/locales/pt-PT.yaml | 2 +-
static/locales/pt.yaml | 1 +
static/locales/ro.yaml | 2 +-
static/locales/ru.yaml | 2 +-
static/locales/sv.yaml | 2 +-
static/locales/tr.yaml | 2 +-
static/locales/uk.yaml | 2 +-
static/locales/zh-CN.yaml | 2 +-
static/locales/zh-TW.yaml | 2 +-
32 files changed, 35 insertions(+), 34 deletions(-)
diff --git a/src/renderer/views/Channel/Channel.vue b/src/renderer/views/Channel/Channel.vue
index 114aaa16ab487..9c3b5422e0c2f 100644
--- a/src/renderer/views/Channel/Channel.vue
+++ b/src/renderer/views/Channel/Channel.vue
@@ -188,7 +188,7 @@
@click="changeTab('community')"
@keydown.left.right.enter.space="changeTab('community', $event)"
>
- {{ $t("Channel.Community.Community").toUpperCase() }}
+ {{ $t("Global.Community").toUpperCase() }}
Date: Tue, 29 Aug 2023 17:25:12 -0700
Subject: [PATCH 5/9] dont show community when useRss is set
---
src/renderer/views/Subscriptions/Subscriptions.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/renderer/views/Subscriptions/Subscriptions.js b/src/renderer/views/Subscriptions/Subscriptions.js
index 829c4fdb09e5c..8c5749e90af4c 100644
--- a/src/renderer/views/Subscriptions/Subscriptions.js
+++ b/src/renderer/views/Subscriptions/Subscriptions.js
@@ -46,6 +46,10 @@ export default defineComponent({
activeSubscriptionList: function () {
return this.activeProfile.subscriptions
},
+ useRssFeeds: function () {
+ return this.$store.getters.getUseRssFeeds
+ },
+
visibleTabs: function () {
const tabs = []
@@ -62,7 +66,7 @@ export default defineComponent({
}
// community does not support rss
- if (!this.hideSubscriptionsCommunity && this.activeSubscriptionList.length < 125) {
+ if (!this.hideSubscriptionsCommunity && !this.useRssFeeds && this.activeSubscriptionList.length < 125) {
tabs.push('community')
}
From fe3584805d40319d730f846fb4df45952099ea54 Mon Sep 17 00:00:00 2001
From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Date: Tue, 29 Aug 2023 19:01:36 -0700
Subject: [PATCH 6/9] check visibleTabs for showing the community tab
---
src/renderer/views/Subscriptions/Subscriptions.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/renderer/views/Subscriptions/Subscriptions.vue b/src/renderer/views/Subscriptions/Subscriptions.vue
index 923c719b8638f..0ff44aa1c6a24 100644
--- a/src/renderer/views/Subscriptions/Subscriptions.vue
+++ b/src/renderer/views/Subscriptions/Subscriptions.vue
@@ -57,7 +57,7 @@
Date: Wed, 6 Sep 2023 14:09:27 -0400
Subject: [PATCH 7/9] fix caching, decrease datalimit for community, add
missing translations
---
.../components/ft-community-post/ft-community-post.js | 10 ++++------
.../subscriptions-community.vue | 3 ++-
.../subscriptions-tab-ui/subscriptions-tab-ui.js | 10 ++++++++--
.../subscriptions-tab-ui/subscriptions-tab-ui.vue | 6 +++---
src/renderer/store/modules/subscriptions.js | 4 ++--
static/locales/en-US.yaml | 2 ++
6 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/src/renderer/components/ft-community-post/ft-community-post.js b/src/renderer/components/ft-community-post/ft-community-post.js
index 2d98438f1ace8..ddd1d714b0a65 100644
--- a/src/renderer/components/ft-community-post/ft-community-post.js
+++ b/src/renderer/components/ft-community-post/ft-community-post.js
@@ -6,7 +6,7 @@ import FtCommunityPoll from '../ft-community-poll/ft-community-poll.vue'
import autolinker from 'autolinker'
import VueTinySlider from 'vue-tiny-slider'
-import { toLocalePublicationString } from '../../helpers/utils'
+import { deepCopy, toLocalePublicationString } from '../../helpers/utils'
import { youtubeImageUrlToInvidious } from '../../helpers/api/invidious'
import 'tiny-slider/dist/tiny-slider.css'
@@ -78,18 +78,16 @@ export default defineComponent({
return
}
this.postText = autolinker.link(this.data.postText)
- let authorThumbnails = this.data.authorThumbnails
+ const authorThumbnails = deepCopy(this.data.authorThumbnails)
if (!process.env.IS_ELECTRON || this.backendPreference === 'invidious') {
- authorThumbnails = authorThumbnails.map(thumbnail => {
+ authorThumbnails.forEach(thumbnail => {
thumbnail.url = youtubeImageUrlToInvidious(thumbnail.url)
- return thumbnail
})
} else {
- authorThumbnails = authorThumbnails.map(thumbnail => {
+ authorThumbnails.forEach(thumbnail => {
if (thumbnail.url.startsWith('//')) {
thumbnail.url = 'https:' + thumbnail.url
}
- return thumbnail
})
}
this.authorThumbnails = authorThumbnails
diff --git a/src/renderer/components/subscriptions-community/subscriptions-community.vue b/src/renderer/components/subscriptions-community/subscriptions-community.vue
index c7d19dc7a2937..8c2e504c25ef1 100644
--- a/src/renderer/components/subscriptions-community/subscriptions-community.vue
+++ b/src/renderer/components/subscriptions-community/subscriptions-community.vue
@@ -4,7 +4,8 @@
:video-list="postList"
:error-channels="errorChannels"
:attempted-fetch="attemptedFetch"
- :display-list="true"
+ :is-community="true"
+ :initial-data-limit="20"
@refresh="loadPostsForSubscriptionsFromRemote"
/>
diff --git a/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.js b/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.js
index 6d3c6e1d5518b..5ed0acf76ded7 100644
--- a/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.js
+++ b/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.js
@@ -28,7 +28,7 @@ export default defineComponent({
type: Array,
default: () => ([])
},
- displayList: {
+ isCommunity: {
type: Boolean,
default: false
},
@@ -40,6 +40,10 @@ export default defineComponent({
type: Boolean,
default: false
},
+ initialDataLimit: {
+ type: Number,
+ default: 100
+ }
},
data: function () {
return {
@@ -72,6 +76,8 @@ export default defineComponent({
if (dataLimit !== null) {
this.dataLimit = dataLimit
+ } else {
+ this.dataLimit = this.initialDataLimit
}
},
mounted: async function () {
@@ -82,7 +88,7 @@ export default defineComponent({
},
methods: {
increaseLimit: function () {
- this.dataLimit += 100
+ this.dataLimit += this.initialDataLimit
sessionStorage.setItem('subscriptionLimit', this.dataLimit)
},
diff --git a/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.vue b/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.vue
index ba075d8ae7401..cd54567ad14e0 100644
--- a/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.vue
+++ b/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.vue
@@ -36,20 +36,20 @@
v-else
class="message"
>
- {{ $t("Subscriptions.Empty Channels") }}
+ {{ isCommunity ? $t("Subscriptions.Empty Posts") : $t("Subscriptions.Empty Channels") }}
Date: Mon, 18 Sep 2023 12:56:47 -0400
Subject: [PATCH 8/9] L: Hide shared posts, IV: Don't show errors for empty
community tab
---
.../subscriptions-community.js | 4 ++--
src/renderer/helpers/api/invidious.js | 7 +++++-
src/renderer/helpers/api/local.js | 23 +++++++++++++++++--
src/renderer/views/Channel/Channel.js | 6 ++---
4 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/src/renderer/components/subscriptions-community/subscriptions-community.js b/src/renderer/components/subscriptions-community/subscriptions-community.js
index af4e2987568bd..e975e97c79e62 100644
--- a/src/renderer/components/subscriptions-community/subscriptions-community.js
+++ b/src/renderer/components/subscriptions-community/subscriptions-community.js
@@ -196,8 +196,8 @@ export default defineComponent({
}).catch((err) => {
console.error(err)
const errorMessage = this.$t('Invidious API Error (Click to copy)')
- showToast(`${errorMessage}: ${err.responseText}`, 10000, () => {
- copyToClipboard(err.responseText)
+ showToast(`${errorMessage}: ${err}`, 10000, () => {
+ copyToClipboard(err)
})
if (process.env.IS_ELECTRON && this.backendPreference === 'invidious' && this.backendFallback) {
showToast(this.$t('Falling back to the local API'))
diff --git a/src/renderer/helpers/api/invidious.js b/src/renderer/helpers/api/invidious.js
index e69358cee64b9..99dd706ac3caa 100644
--- a/src/renderer/helpers/api/invidious.js
+++ b/src/renderer/helpers/api/invidious.js
@@ -24,7 +24,12 @@ export function invidiousAPICall({ resource, id = '', params = {}, doLogError =
.then((response) => response.json())
.then((json) => {
if (json.error !== undefined) {
- throw new Error(json.error)
+ // community is empty, no need to display error.
+ if (json.error === 'This channel hasn\'t posted yet') {
+ resolve({ comments: [] })
+ } else {
+ throw new Error(json.error)
+ }
}
resolve(json)
})
diff --git a/src/renderer/helpers/api/local.js b/src/renderer/helpers/api/local.js
index e3e6f5d5855a5..5827fc975f995 100644
--- a/src/renderer/helpers/api/local.js
+++ b/src/renderer/helpers/api/local.js
@@ -302,7 +302,7 @@ export async function getLocalChannelCommunity(id) {
// if the channel doesn't have a community tab, YouTube returns the home tab instead
// so we need to check that we got the right tab
if (communityTab.current_tab?.endpoint.metadata.url?.endsWith('/community')) {
- return communityTab.posts.map(parseLocalCommunityPost)
+ return parseLocalCommunityPosts(communityTab.posts)
} else {
return []
}
@@ -909,9 +909,28 @@ export function parseLocalSubscriberCount(text) {
/**
* Parse community posts
+ * @param {import('youtubei.js').YTNodes.BackstagePost[] | import('youtubei.js').YTNodes.SharedPost[] | import('youtubei.js').YTNodes.Post[] } posts
+ */
+export function parseLocalCommunityPosts(posts) {
+ const foundIds = []
+ // `posts` includes the SharedPost's attached post for some reason so we need to filter that out.
+ // we don't currently support SharedPost's so that is also filtered out
+ for (const post of posts) {
+ if (post.type === 'SharedPost') {
+ foundIds.push(post.original_post.id, post.id)
+ }
+ }
+
+ return posts.filter(post => {
+ return !foundIds.includes(post.id)
+ }).map(parseLocalCommunityPost)
+}
+
+/**
+ * Parse community post
* @param {import('youtubei.js').YTNodes.BackstagePost} post
*/
-export function parseLocalCommunityPost(post) {
+function parseLocalCommunityPost(post) {
let replyCount = post.action_buttons?.reply_button?.text ?? null
if (replyCount !== null) {
replyCount = parseLocalSubscriberCount(post?.action_buttons.reply_button.text)
diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js
index 0e494a2778892..93ad7b5695ab9 100644
--- a/src/renderer/views/Channel/Channel.js
+++ b/src/renderer/views/Channel/Channel.js
@@ -27,7 +27,7 @@ import {
getLocalChannelId,
parseLocalChannelShorts,
parseLocalChannelVideos,
- parseLocalCommunityPost,
+ parseLocalCommunityPosts,
parseLocalListPlaylist,
parseLocalListVideo,
parseLocalSubscriberCount
@@ -1576,7 +1576,7 @@ export default defineComponent({
posts = communityTab.posts
}
- this.latestCommunityPosts = posts.map(parseLocalCommunityPost)
+ this.latestCommunityPosts = parseLocalCommunityPosts(posts)
this.communityContinuationData = communityTab.has_continuation ? communityTab : null
} catch (err) {
console.error(err)
@@ -1608,7 +1608,7 @@ export default defineComponent({
posts = continuation.posts
}
- this.latestCommunityPosts = this.latestCommunityPosts.concat(posts.map(parseLocalCommunityPost))
+ this.latestCommunityPosts = this.latestCommunityPosts.concat(parseLocalCommunityPosts(posts))
this.communityContinuationData = continuation.has_continuation ? continuation : null
} catch (err) {
console.error(err)
From 29df96822813d263186f2ccf755cd02436a39227 Mon Sep 17 00:00:00 2001
From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Date: Mon, 18 Sep 2023 13:40:43 -0400
Subject: [PATCH 9/9] add links to related issues
---
src/renderer/helpers/api/invidious.js | 1 +
src/renderer/helpers/api/local.js | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/renderer/helpers/api/invidious.js b/src/renderer/helpers/api/invidious.js
index 99dd706ac3caa..c8e4883bc5fa5 100644
--- a/src/renderer/helpers/api/invidious.js
+++ b/src/renderer/helpers/api/invidious.js
@@ -25,6 +25,7 @@ export function invidiousAPICall({ resource, id = '', params = {}, doLogError =
.then((json) => {
if (json.error !== undefined) {
// community is empty, no need to display error.
+ // This code can be removed when: https://github.com/iv-org/invidious/issues/3814 is reolved
if (json.error === 'This channel hasn\'t posted yet') {
resolve({ comments: [] })
} else {
diff --git a/src/renderer/helpers/api/local.js b/src/renderer/helpers/api/local.js
index 5827fc975f995..98115c2357a07 100644
--- a/src/renderer/helpers/api/local.js
+++ b/src/renderer/helpers/api/local.js
@@ -914,6 +914,7 @@ export function parseLocalSubscriberCount(text) {
export function parseLocalCommunityPosts(posts) {
const foundIds = []
// `posts` includes the SharedPost's attached post for some reason so we need to filter that out.
+ // see: https://github.com/FreeTubeApp/FreeTube/issues/3252#issuecomment-1546675781
// we don't currently support SharedPost's so that is also filtered out
for (const post of posts) {
if (post.type === 'SharedPost') {