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.class.Applicant,
recruit.ids.ApplicationNotificationGroup, recruit.ids.ApplicationNotificationGroup,
[], [],
['comments', 'state', 'doneState'] ['comments', 'state', 'doneState', 'dueDate']
) )
builder.createDoc( builder.createDoc(

View File

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

View File

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

View File

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