Skip to content

Commit

Permalink
Merge branch 'hcengineering:main' into vacancies-explicit-hide-archiv…
Browse files Browse the repository at this point in the history
…ed-viewoptions-hcengineering#4003
  • Loading branch information
Syarg authored Dec 20, 2023
2 parents 7b92f16 + f0dbfe3 commit 54a96b3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
4 changes: 4 additions & 0 deletions models/server-activity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ export function createModel (builder: Builder): void {
builder.createDoc(serverCore.class.Trigger, core.space.Model, {
trigger: serverActivity.trigger.ActivityMessagesHandler
})

builder.createDoc(serverCore.class.Trigger, core.space.Model, {
trigger: serverActivity.trigger.OnDocRemoved
})
}
10 changes: 10 additions & 0 deletions packages/ui/src/components/DropdownLabels.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import Button from './Button.svelte'
import DropdownLabelsPopup from './DropdownLabelsPopup.svelte'
import Label from './Label.svelte'
import DropdownIcon from './icons/Dropdown.svelte'
export let icon: Asset | AnySvelteComponent | undefined = undefined
export let label: IntlString | undefined = undefined
Expand All @@ -30,6 +31,7 @@
export let multiselect = false
export let selected: DropdownTextItem['id'] | Array<DropdownTextItem['id']> | undefined = multiselect ? [] : undefined
export let allowDeselect: boolean = false
export let showDropdownIcon: boolean = false
export let kind: ButtonKind = 'no-border'
export let size: ButtonSize = 'small'
Expand Down Expand Up @@ -113,6 +115,14 @@
<Label label={label ?? ui.string.NotSelected} />
{/if}
</span>
<svelte:fragment slot="iconRight">
{#if showDropdownIcon}
<DropdownIcon
size={'small'}
fill={kind === 'primary' && !disabled ? 'var(--primary-button-content-color)' : 'var(--theme-dark-color)'}
/>
{/if}
</svelte:fragment>
</Button>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

{#if value}
<div class="flex-presenter" style:color={'inherit'}>
{#if !inline}
{#if !inline && shouldShowAvatar}
<IssueStatusIcon {value} {size} {space} on:accent-color {projectType} {taskType} />
{/if}
<span
Expand Down
25 changes: 24 additions & 1 deletion server-plugins/activity-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,33 @@ async function ActivityMessagesHandler (tx: TxCUD<Doc>, control: TriggerControl)
return await generateDocUpdateMessages(tx, control)
}

async function OnDocRemoved (originTx: TxCUD<Doc>, control: TriggerControl): Promise<Tx[]> {
const tx = TxProcessor.extractTx(originTx) as TxCUD<Doc>

if (tx._class !== core.class.TxRemoveDoc) {
return []
}

const activityDocMixin = control.hierarchy.classHierarchyMixin(tx.objectClass, activity.mixin.ActivityDoc)

if (activityDocMixin === undefined) {
return []
}

const messages = await control.findAll(
activity.class.ActivityMessage,
{ attachedTo: tx.objectId },
{ projection: { _id: 1, _class: 1, space: 1 } }
)

return messages.map((message) => control.txFactory.createTxRemoveDoc(message._class, message.space, message._id))
}

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export default async () => ({
trigger: {
// OnReactionChanged,
ActivityMessagesHandler
ActivityMessagesHandler,
OnDocRemoved
}
})
3 changes: 2 additions & 1 deletion server-plugins/activity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const serverActivityId = 'server-activity' as Plugin
*/
export default plugin(serverActivityId, {
trigger: {
ActivityMessagesHandler: '' as Resource<TriggerFunc>
ActivityMessagesHandler: '' as Resource<TriggerFunc>,
OnDocRemoved: '' as Resource<TriggerFunc>
}
})

0 comments on commit 54a96b3

Please sign in to comment.