fix predicate and attachments

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-09-12 16:00:45 +02:00
parent 8146b255d2
commit f59ca31d5d
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
3 changed files with 6 additions and 8 deletions

View File

@ -47,7 +47,7 @@ const predicates: Record<string, PredicateFactory> = {
}
export function isPredicate (o: Record<string, any>): boolean {
if (typeof o !== 'object') { return false }
if (o === null || typeof o !== 'object') { return false }
const keys = Object.keys(o)
return keys.length > 0 && keys.every((key) => key.startsWith('$'))
}

View File

@ -23,14 +23,12 @@
import chunter from '@anticrm/chunter'
export let object: Doc
export let space: Ref<Space>
// export let space: Ref<Space>
let files: Attachment[] = [{ name: 'Application description.pdf', type: 'PDF / 2,5 MB' }, { name: 'Application description.pdf', type: 'PDF / 2,5 MB' }]
console.log('query space', space)
let files: Attachment[] = []
const query = createQuery()
// $: query.query(chunter.class.Attachment, { space }, result => { files = result})
$: query.query(chunter.class.Attachment, { attachmentTo: object._id }, result => { files = result})
</script>
@ -42,7 +40,7 @@
<table class="table-body">
<thead>
<tr class="tr-head">
<th>Attachments (2)</th>
<th>Attachments</th>
<th>Time</th>
</tr>
</thead>

View File

@ -140,7 +140,7 @@
</div>
<div class="attachments">
<Attachments />
<Attachments {object}/>
</div>
</Panel>