id-optional-fix-2
This commit is contained in:
parent
b295ba0dbf
commit
6cc6b4f5ac
|
@ -43,8 +43,10 @@ export const Comment = (props: Props) => {
|
|||
const { showConfirm } = useConfirm()
|
||||
const { showSnackbar } = useSnackbar()
|
||||
|
||||
const canEdit = createMemo ( () =>
|
||||
Boolean(author()?.id) && ((props.comment?.created_by?.id === author().id) || session()?.user?.roles.includes('editor'))
|
||||
const canEdit = createMemo(
|
||||
() =>
|
||||
Boolean(author()?.id) &&
|
||||
(props.comment?.created_by?.id === author().id || session()?.user?.roles.includes('editor')),
|
||||
)
|
||||
|
||||
const comment = createMemo(() => props.comment)
|
||||
|
|
|
@ -79,9 +79,12 @@ export const FullArticle = (props: Props) => {
|
|||
|
||||
const formattedDate = createMemo(() => formatDate(new Date(props.article.published_at * 1000)))
|
||||
|
||||
const canEdit = createMemo(() =>
|
||||
Boolean(author()?.id) && ((props.article?.authors?.some((a) => Boolean(a) && a?.id === author().id)) ||
|
||||
(props.article?.created_by?.id === author().id) || session()?.user?.roles.includes('editor'))
|
||||
const canEdit = createMemo(
|
||||
() =>
|
||||
Boolean(author()?.id) &&
|
||||
(props.article?.authors?.some((a) => Boolean(a) && a?.id === author().id) ||
|
||||
props.article?.created_by?.id === author().id ||
|
||||
session()?.user?.roles.includes('editor')),
|
||||
)
|
||||
|
||||
const mainTopic = createMemo(() => {
|
||||
|
|
|
@ -120,9 +120,12 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
|||
props.article.published_at ? formatDate(new Date(props.article.published_at * 1000)) : '',
|
||||
)
|
||||
|
||||
const canEdit = createMemo(() =>
|
||||
Boolean(author()?.id) && ((props.article?.authors?.some((a) => Boolean(a) && a?.id === author().id)) ||
|
||||
(props.article?.created_by?.id === author().id) || session()?.user?.roles.includes('editor'))
|
||||
const canEdit = createMemo(
|
||||
() =>
|
||||
Boolean(author()?.id) &&
|
||||
(props.article?.authors?.some((a) => Boolean(a) && a?.id === author().id) ||
|
||||
props.article?.created_by?.id === author().id ||
|
||||
session()?.user?.roles.includes('editor')),
|
||||
)
|
||||
|
||||
const scrollToComments = (event) => {
|
||||
|
|
|
@ -184,9 +184,7 @@ export const apiClient = {
|
|||
return response.data.delete_reaction.reaction
|
||||
},
|
||||
updateReaction: async (reaction: ReactionInput) => {
|
||||
const response = await apiClient.private
|
||||
.mutation(reactionUpdate, { reaction })
|
||||
.toPromise()
|
||||
const response = await apiClient.private.mutation(reactionUpdate, { reaction }).toPromise()
|
||||
console.debug('[graphql.client.core] updateReaction:', response)
|
||||
return response.data.update_reaction.reaction
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user