condition-fix
This commit is contained in:
parent
19bba97d73
commit
869cf5bb1a
|
@ -43,11 +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)
|
||||||
const body = createMemo(() => (comment().body || '').trim())
|
const body = createMemo(() => (comment().body || '').trim())
|
||||||
|
|
||||||
|
|
|
@ -79,12 +79,9 @@ 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)) ||
|
||||||
Boolean(author()?.id) &&
|
(props.article?.created_by.id === author().id) || session()?.user?.roles.includes('editor'))
|
||||||
(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,12 +120,9 @@ 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)) ||
|
||||||
Boolean(author()?.id) &&
|
(props.article?.created_by.id === author().id) || session()?.user?.roles.includes('editor'))
|
||||||
(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) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user