TSK-1263 Fix inbox settings (#3082)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-04-26 14:54:41 +06:00 committed by GitHub
parent 564a361db0
commit db90c6e88c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 30 deletions

View File

@ -1126,7 +1126,7 @@ export function createModel (builder: Builder): void {
recruit.class.Applicant,
recruit.ids.ApplicationNotificationGroup,
[],
['comments', 'state', 'doneState']
['comments', 'state', 'doneState', 'dueDate']
)
builder.createDoc(

View File

@ -1856,7 +1856,7 @@ export function createModel (builder: Builder): void {
tracker.class.Issue,
tracker.ids.TrackerNotificationGroup,
[],
['comments', 'status', 'priority']
['comments', 'status', 'priority', 'assignee', 'subIssues', 'blockedBy', 'sprint', 'dueDate']
)
createAction(

View File

@ -21,7 +21,7 @@
NotificationType
} from '@hcengineering/notification'
import { IntlString } from '@hcengineering/platform'
import { getClient } from '@hcengineering/presentation'
import { createQuery, getClient } from '@hcengineering/presentation'
import { Grid, Label, ToggleWithLabel } from '@hcengineering/ui'
import notification from '../plugin'
@ -34,11 +34,15 @@
let providers: NotificationProvider[] = []
let providersMap: IdMap<NotificationProvider> = new Map()
$: load(group)
load()
async function load (group: Ref<NotificationGroup>) {
types = await client.findAll(notification.class.NotificationType, { group })
const query = createQuery()
$: query.query(notification.class.NotificationType, { group }, (res) => {
types = res
typesMap = toIdMap(types)
})
async function load () {
providers = await client.findAll(notification.class.NotificationProvider, {})
providersMap = toIdMap(providers)
}
@ -100,30 +104,32 @@
}
</script>
<div class="flex-grow container">
<Grid {column} columnGap={5} rowGap={1.5}>
{#each types as type}
<div class="flex">
{#if type.generated}
<Label label={getLabel(type)} />:
{/if}
<Label label={type.label} />
</div>
{#each providers as provider (provider._id)}
{#if type.providers[provider._id] !== undefined}
<div class="toggle">
<ToggleWithLabel
label={provider.label}
on={getStatus(settings, type._id, provider._id)}
on:change={createHandler(type._id, provider._id)}
/>
</div>
{:else}
<div />
{/if}
<div class="flex-grow vScroll w-full">
<div class="container">
<Grid {column} columnGap={5} rowGap={1.5}>
{#each types as type}
<div class="flex">
{#if type.generated}
<Label label={getLabel(type)} />:
{/if}
<Label label={type.label} />
</div>
{#each providers as provider (provider._id)}
{#if type.providers[provider._id] !== undefined}
<div class="toggle">
<ToggleWithLabel
label={provider.label}
on={getStatus(settings, type._id, provider._id)}
on:change={createHandler(type._id, provider._id)}
/>
</div>
{:else}
<div />
{/if}
{/each}
{/each}
{/each}
</Grid>
</Grid>
</div>
</div>
<style lang="scss">

View File

@ -787,7 +787,9 @@ export async function OnAttributeCreate (tx: Tx, control: TriggerControl): Promi
const ctx = tx as TxCreateDoc<AnyAttribute>
if (ctx.objectClass !== core.class.Attribute) return []
const attribute = TxProcessor.createDoc2Doc(ctx)
const group = (await control.findAll(notification.class.NotificationGroup, { objectClass: attribute.attributeOf }))[0]
const group = (
await control.modelDb.findAll(notification.class.NotificationGroup, { objectClass: attribute.attributeOf })
)[0]
if (group === undefined) return []
const isCollection: boolean = core.class.Collection === attribute.type._class
const objectClass = !isCollection ? attribute.attributeOf : (attribute.type as Collection<AttachedDoc>).of