diff --git a/models/chunter/src/index.ts b/models/chunter/src/index.ts index 2cb8cc412e..ee376ce0b9 100644 --- a/models/chunter/src/index.ts +++ b/models/chunter/src/index.ts @@ -55,6 +55,7 @@ import view, { createAction, actionTemplates as viewTemplates } from '@hcenginee import workbench from '@hcengineering/model-workbench' import chunter from './plugin' import { type AnyComponent } from '@hcengineering/ui/src/types' +import { TypeBoolean } from '@hcengineering/model' export { chunterId } from '@hcengineering/chunter' export { chunterOperation } from './migration' @@ -153,6 +154,9 @@ export class TComment extends TAttachedDoc implements Comment { @Prop(Collection(chunter.class.Reaction), chunter.string.Reactions) reactions?: number + + @Prop(TypeBoolean(), chunter.string.PinMessage) + pinned?: boolean } @Model(chunter.class.Backlink, chunter.class.Comment) @@ -753,6 +757,18 @@ export function createModel (builder: Builder, options = { addApplication: true chunter.ids.ActivityExtension ) + builder.createDoc( + activity.class.ActivityExtension, + core.space.Model, + { + ofClass: chunter.class.Comment, + components: { + action: chunter.component.PinComment + } + }, + chunter.ids.PinExtension + ) + builder.createDoc( activity.class.ActivityExtension, core.space.Model, diff --git a/models/chunter/src/plugin.ts b/models/chunter/src/plugin.ts index 65748b3860..c485cf36fc 100644 --- a/models/chunter/src/plugin.ts +++ b/models/chunter/src/plugin.ts @@ -34,7 +34,8 @@ export default mergeIds(chunterId, chunter, { SavedMessages: '' as AnyComponent, ChunterBrowser: '' as AnyComponent, CommentReactions: '' as AnyComponent, - ReactionsAction: '' as AnyComponent + ReactionsAction: '' as AnyComponent, + PinComment: '' as AnyComponent }, action: { MarkCommentUnread: '' as Ref, @@ -93,7 +94,8 @@ export default mergeIds(chunterId, chunter, { TxMessageCreate: '' as Ref, ChunterNotificationGroup: '' as Ref, ActivityExtension: '' as Ref, - BackLinkActivityExtension: '' as Ref + BackLinkActivityExtension: '' as Ref, + PinExtension: '' as Ref }, activity: { TxCommentCreate: '' as AnyComponent, diff --git a/plugins/activity-resources/src/components/ActivityFilter.svelte b/plugins/activity-resources/src/components/ActivityFilter.svelte index 43a982b9e3..b226d4f42f 100644 --- a/plugins/activity-resources/src/components/ActivityFilter.svelte +++ b/plugins/activity-resources/src/components/ActivityFilter.svelte @@ -85,8 +85,9 @@ filters: ActivityFilter[], selected: Ref[] | 'All' ): Promise { + const txesSorted = txes.sort((tx) => ((tx.doc as any)?.pinned ? -1 : 1)) if (selected === 'All') { - filtered = txes + filtered = txesSorted dispatch('update', filtered) } else { selectedFilters = filters.filter((filter) => selected.includes(filter._id)) @@ -95,7 +96,7 @@ const fltr = await getResource(filter.filter) filterActions.push(fltr) } - filtered = txes.filter((it) => filterActions.some((f) => f(it, object._class))) + filtered = txesSorted.filter((it) => filterActions.some((f) => f(it, object._class))) dispatch('update', filtered) } } diff --git a/plugins/chunter-resources/src/components/PinComment.svelte b/plugins/chunter-resources/src/components/PinComment.svelte new file mode 100644 index 0000000000..bbb35e1244 --- /dev/null +++ b/plugins/chunter-resources/src/components/PinComment.svelte @@ -0,0 +1,37 @@ + + + + diff --git a/plugins/chunter-resources/src/index.ts b/plugins/chunter-resources/src/index.ts index 6d68ab4b89..4ffdc4b2de 100644 --- a/plugins/chunter-resources/src/index.ts +++ b/plugins/chunter-resources/src/index.ts @@ -71,6 +71,7 @@ import TxCommentCreate from './components/activity/TxCommentCreate.svelte' import TxMessageCreate from './components/activity/TxMessageCreate.svelte' import ReactionsAction from './components/ReactionsAction.svelte' import CommentReactions from './components/CommentReactions.svelte' +import PinComment from './components/PinComment.svelte' import notification from '@hcengineering/notification' import { writable } from 'svelte/store' @@ -310,7 +311,8 @@ export default async (): Promise => ({ SavedMessages, CommentPanel, ReactionsAction, - CommentReactions + CommentReactions, + PinComment }, function: { GetDmName: getDmName, diff --git a/plugins/chunter/src/index.ts b/plugins/chunter/src/index.ts index e891de3a1c..6ef2ae5828 100644 --- a/plugins/chunter/src/index.ts +++ b/plugins/chunter/src/index.ts @@ -103,6 +103,7 @@ export interface Comment extends AttachedDoc { message: string attachments?: number reactions?: number + pinned?: boolean } /**