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 { showConfirm } = useConfirm()
|
||||||
const { showSnackbar } = useSnackbar()
|
const { showSnackbar } = useSnackbar()
|
||||||
|
|
||||||
const canEdit = createMemo ( () =>
|
const canEdit = createMemo(
|
||||||
Boolean(author()?.id) && ((props.comment?.created_by?.id === author().id) || session()?.user?.roles.includes('editor'))
|
() =>
|
||||||
|
Boolean(author()?.id) &&
|
||||||
|
(props.comment?.created_by?.id === author().id || session()?.user?.roles.includes('editor')),
|
||||||
)
|
)
|
||||||
|
|
||||||
const comment = createMemo(() => props.comment)
|
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 formattedDate = createMemo(() => formatDate(new Date(props.article.published_at * 1000)))
|
||||||
|
|
||||||
const canEdit = createMemo(() =>
|
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'))
|
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(() => {
|
const mainTopic = createMemo(() => {
|
||||||
|
|
|
@ -120,9 +120,12 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
props.article.published_at ? formatDate(new Date(props.article.published_at * 1000)) : '',
|
props.article.published_at ? formatDate(new Date(props.article.published_at * 1000)) : '',
|
||||||
)
|
)
|
||||||
|
|
||||||
const canEdit = createMemo(() =>
|
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'))
|
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) => {
|
const scrollToComments = (event) => {
|
||||||
|
|
|
@ -184,9 +184,7 @@ export const apiClient = {
|
||||||
return response.data.delete_reaction.reaction
|
return response.data.delete_reaction.reaction
|
||||||
},
|
},
|
||||||
updateReaction: async (reaction: ReactionInput) => {
|
updateReaction: async (reaction: ReactionInput) => {
|
||||||
const response = await apiClient.private
|
const response = await apiClient.private.mutation(reactionUpdate, { reaction }).toPromise()
|
||||||
.mutation(reactionUpdate, { reaction })
|
|
||||||
.toPromise()
|
|
||||||
console.debug('[graphql.client.core] updateReaction:', response)
|
console.debug('[graphql.client.core] updateReaction:', response)
|
||||||
return response.data.update_reaction.reaction
|
return response.data.update_reaction.reaction
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user