From daca3007bb0931c6f31eb63ad8fc49f8df0c4874 Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 13 Jan 2024 17:14:35 +0300 Subject: [PATCH] ackee-domain --- src/components/Article/FullArticle.tsx | 2 +- src/components/Author/AuthorBadge/AuthorBadge.tsx | 7 ++++--- src/components/Author/AuthorCard/AuthorCard.tsx | 2 +- src/components/Feed/ArticleCard/ArticleCard.tsx | 2 +- src/components/Views/Feed/Feed.tsx | 2 +- src/pages/article.page.tsx | 2 +- src/stores/zine/articles.ts | 2 +- src/stores/zine/authors.ts | 2 +- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx index cc1b672b..6d6500ff 100644 --- a/src/components/Article/FullArticle.tsx +++ b/src/components/Article/FullArticle.tsx @@ -86,7 +86,7 @@ export const FullArticle = (props: Props) => { } }) - const canEdit = () => props.article.authors?.some((a) => a.slug === author()?.slug) + const canEdit = () => props.article.authors?.some((a) => Boolean(a) && a?.slug === author()?.slug) const handleBookmarkButtonClick = (ev) => { requireAuthentication(() => { diff --git a/src/components/Author/AuthorBadge/AuthorBadge.tsx b/src/components/Author/AuthorBadge/AuthorBadge.tsx index ee73006f..80e32c73 100644 --- a/src/components/Author/AuthorBadge/AuthorBadge.tsx +++ b/src/components/Author/AuthorBadge/AuthorBadge.tsx @@ -42,9 +42,10 @@ export const AuthorBadge = (props: Props) => { } = useSession() const { changeSearchParams } = useRouter() const { t, formatDate, lang } = useLocalize() - const subscribed = createMemo(() => - subscriptions().authors.some((a: Author) => a && a.slug === props.author.slug), - ) + const subscribed = createMemo(() => { + let sss = subscriptions() + return sss?.authors.some((a: Author) => a?.slug === props.author.slug) + }) const subscribe = async (really = true) => { setIsSubscribing(true) diff --git a/src/components/Author/AuthorCard/AuthorCard.tsx b/src/components/Author/AuthorCard/AuthorCard.tsx index 4170d055..f8100e00 100644 --- a/src/components/Author/AuthorCard/AuthorCard.tsx +++ b/src/components/Author/AuthorCard/AuthorCard.tsx @@ -43,7 +43,7 @@ export const AuthorCard = (props: Props) => { const [subscriptionFilter, setSubscriptionFilter] = createSignal('all') const subscribed = createMemo(() => - subscriptions().authors.some((a: Author) => a && a.slug === props.author.slug), + subscriptions().authors.some((a: Author) => a?.slug === props.author.slug), ) const subscribe = async (really = true) => { diff --git a/src/components/Feed/ArticleCard/ArticleCard.tsx b/src/components/Feed/ArticleCard/ArticleCard.tsx index c070b880..90fc442d 100644 --- a/src/components/Feed/ArticleCard/ArticleCard.tsx +++ b/src/components/Feed/ArticleCard/ArticleCard.tsx @@ -104,7 +104,7 @@ export const ArticleCard = (props: ArticleCardProps) => { const { title, subtitle } = getTitleAndSubtitle(props.article) const canEdit = () => - props.article.authors?.some((a) => a.slug === author()?.slug) || + props.article.authors?.some((a) => a && a?.slug === author()?.slug) || props.article.created_by?.id === author()?.id const { changeSearchParams } = useRouter() diff --git a/src/components/Views/Feed/Feed.tsx b/src/components/Views/Feed/Feed.tsx index 6cc40748..5d8933e2 100644 --- a/src/components/Views/Feed/Feed.tsx +++ b/src/components/Views/Feed/Feed.tsx @@ -408,7 +408,7 @@ export const FeedView = (props: Props) => { - 0}> +

{t('Be the first to rate')}

diff --git a/src/pages/article.page.tsx b/src/pages/article.page.tsx index 15db27a8..a7d89347 100644 --- a/src/pages/article.page.tsx +++ b/src/pages/article.page.tsx @@ -41,7 +41,7 @@ export const ArticlePage = (props: PageProps) => { script.async = true script.src = 'https://ackee.discours.io/increment.js' script.dataset.ackeeServer = 'https://ackee.discours.io' - script.dataset.ackeeDomainId = '306f0723-77cc-4c11-8b9c-8415a1e9daf0' + script.dataset.ackeeDomainId = '2a6df3a8-53ac-4383-8cc6-73d38cea4524' try { document.body.appendChild(script) } catch (error) { diff --git a/src/stores/zine/articles.ts b/src/stores/zine/articles.ts index f2bd0ee4..9785a4fb 100644 --- a/src/stores/zine/articles.ts +++ b/src/stores/zine/articles.ts @@ -93,7 +93,7 @@ const addArticles = (...args: Shout[][]) => { } authors.forEach((author) => { - if (!acc[topic.slug].some((a) => a.slug === author.slug)) { + if (!acc[topic.slug].some((a) => a?.slug === author.slug)) { acc[topic.slug].push(author) } }) diff --git a/src/stores/zine/authors.ts b/src/stores/zine/authors.ts index 35422d72..161b7642 100644 --- a/src/stores/zine/authors.ts +++ b/src/stores/zine/authors.ts @@ -79,7 +79,7 @@ export const addAuthorsByTopic = (newAuthorsByTopic: { [topicSlug: string]: Auth } authors.forEach((author) => { - if (!acc[topicSlug].some((a) => a.slug === author.slug)) { + if (!acc[topicSlug].some((a) => a?.slug === author.slug)) { acc[topicSlug].push(author) } })