From 7b3ab334813ed2fd6f4db2c5edb0b3bdd1502611 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 30 Nov 2023 11:07:31 +0300 Subject: [PATCH] schema-updates --- src/components/Article/CommentRatingControl.tsx | 12 ++++++------ src/components/Article/CommentsTree.tsx | 4 ++-- src/components/Article/FullArticle.tsx | 4 ++-- src/components/Article/ShoutRatingControl.tsx | 6 +++--- src/components/Editor/Editor.tsx | 6 +++--- src/components/Feed/ArticleCard/ArticleCard.tsx | 5 +++-- src/components/Nav/Header/Header.tsx | 8 +------- src/context/reactions.tsx | 14 ++++++++++++-- src/graphql/client/core.ts | 4 ++-- src/graphql/query/core/article-load.ts | 16 +++++++++++++++- src/graphql/query/core/articles-load-by.ts | 9 +++++++-- src/graphql/query/core/articles-load-drafts.ts | 8 +++++++- src/graphql/query/core/articles-load-feed.ts | 8 +++++++- src/graphql/query/core/articles-load-followed.ts | 8 +++++++- src/graphql/query/core/articles-load-search.ts | 7 +++++++ 15 files changed, 84 insertions(+), 35 deletions(-) diff --git a/src/components/Article/CommentRatingControl.tsx b/src/components/Article/CommentRatingControl.tsx index 7c189b47..4fb906c1 100644 --- a/src/components/Article/CommentRatingControl.tsx +++ b/src/components/Article/CommentRatingControl.tsx @@ -18,7 +18,7 @@ type Props = { export const CommentRatingControl = (props: Props) => { const { t } = useLocalize() - const { user } = useSession() + const { author } = useSession() const { actions: { showSnackbar }, } = useSnackbar() @@ -31,13 +31,13 @@ export const CommentRatingControl = (props: Props) => { Object.values(reactionEntities).some( (r) => r.kind === reactionKind && - r.created_by.slug === user()?.slug && + r.created_by.slug === author()?.slug && r.shout.id === props.comment.shout.id && r.reply_to === props.comment.id, ) const isUpvoted = createMemo(() => checkReaction(ReactionKind.Like)) const isDownvoted = createMemo(() => checkReaction(ReactionKind.Dislike)) - const canVote = createMemo(() => user()?.slug !== props.comment.created_by.slug) + const canVote = createMemo(() => author()?.slug !== props.comment.created_by.slug) const commentRatingReactions = createMemo(() => Object.values(reactionEntities).filter( @@ -52,7 +52,7 @@ export const CommentRatingControl = (props: Props) => { const reactionToDelete = Object.values(reactionEntities).find( (r) => r.kind === reactionKind && - r.created_by.slug === user()?.slug && + r.created_by.slug === author()?.slug && r.shout.id === props.comment.shout.id && r.reply_to === props.comment.id, ) @@ -86,7 +86,7 @@ export const CommentRatingControl = (props: Props) => {