=> {
const actions = await getActions(client, message, chunter.class.Message)
actions.push(subscribeAction)
@@ -73,7 +88,8 @@
const impl = await getResource(a.action)
await impl(message)
}
- }))
+ })),
+ ...(getCurrentAccount()._id === message.createBy ? [deleteAction] : [])
]
},
ev.target as HTMLElement
@@ -108,7 +124,7 @@
{#if !thread}
- {#if message.replies} await client.removeDoc(message._class, message.space, message._id)
+ }
+
const showMenu = async (ev: Event): Promise => {
const actions = await getActions(client, message, chunter.class.ThreadMessage)
actions.push(subscribeAction)
@@ -67,7 +72,8 @@
const impl = await getResource(a.action)
await impl(message)
}
- }))
+ })),
+ ...(getCurrentAccount()._id === message.createBy ? [deleteAction] : [])
]
},
ev.target as HTMLElement
diff --git a/plugins/chunter-resources/src/plugin.ts b/plugins/chunter-resources/src/plugin.ts
index e08dbcf25e..cba353810e 100644
--- a/plugins/chunter-resources/src/plugin.ts
+++ b/plugins/chunter-resources/src/plugin.ts
@@ -50,6 +50,7 @@ export default mergeIds(chunterId, chunter, {
LastReply: '' as IntlString,
New: '' as IntlString,
GetNewReplies: '' as IntlString,
- TurnOffReplies: '' as IntlString
+ TurnOffReplies: '' as IntlString,
+ DeleteMessage: '' as IntlString
}
})
diff --git a/server-plugins/chunter-resources/src/index.ts b/server-plugins/chunter-resources/src/index.ts
index 1784ccf069..fbc79374e6 100644
--- a/server-plugins/chunter-resources/src/index.ts
+++ b/server-plugins/chunter-resources/src/index.ts
@@ -13,9 +13,9 @@
// limitations under the License.
//
-import chunter, { Channel, Comment, Message } from '@anticrm/chunter'
+import chunter, { Channel, Comment, Message, ThreadMessage } from '@anticrm/chunter'
import { EmployeeAccount } from '@anticrm/contact'
-import core, { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref, Tx, TxCreateDoc, TxProcessor, TxUpdateDoc } from '@anticrm/core'
+import core, { Class, Doc, DocumentQuery, FindOptions, FindResult, Hierarchy, Ref, Tx, TxCreateDoc, TxProcessor, TxUpdateDoc, TxRemoveDoc } from '@anticrm/core'
import login from '@anticrm/login'
import { getMetadata } from '@anticrm/platform'
import { TriggerControl } from '@anticrm/server-core'
@@ -58,7 +58,7 @@ export async function CommentCreate (tx: Tx, control: TriggerControl): Promise)
- if (!hierarchy.isDerived(doc._class, chunter.class.Comment)) {
+ if (!hierarchy.isDerived(doc._class, chunter.class.ThreadMessage)) {
return []
}
@@ -80,6 +80,44 @@ export async function CommentCreate (tx: Tx, control: TriggerControl): Promise {
+ const hierarchy = control.hierarchy
+ if (tx._class !== core.class.TxRemoveDoc) return []
+
+ const rmTx = tx as TxRemoveDoc
+ if (!hierarchy.isDerived(rmTx.objectClass, chunter.class.ThreadMessage)) {
+ return []
+ }
+ const createTx = (await control.findAll(core.class.TxCreateDoc, {
+ objectId: rmTx.objectId
+ }, { limit: 1 }))[0]
+
+ const comment = TxProcessor.createDoc2Doc(createTx as TxCreateDoc)
+
+ const comments = await control.findAll(chunter.class.ThreadMessage, {
+ attachedTo: comment.attachedTo
+ })
+ const updateTx = control.txFactory.createTxUpdateDoc(
+ chunter.class.Message,
+ comment.space,
+ comment.attachedTo,
+ {
+ replies:
+ comments
+ .map(comm => (control.modelDb.getObject(comm.createBy) as EmployeeAccount).employee),
+ lastReply:
+ comments.length > 0
+ ? Math.max(...comments.map(comm => comm.createOn))
+ : undefined
+ }
+ )
+
+ return [updateTx]
+}
+
/**
* @public
*/
@@ -112,7 +150,8 @@ export async function MessageCreate (tx: Tx, control: TriggerControl): Promise {
const promises = [
MessageCreate(tx, control),
- CommentCreate(tx, control)
+ CommentCreate(tx, control),
+ CommentDelete(tx, control)
]
const res = await Promise.all(promises)
return res.flat()
From fd92ec7d8c32f38338b50282b4daef9ba9c12d3a Mon Sep 17 00:00:00 2001
From: Artyom Grigorovich
Date: Wed, 13 Apr 2022 00:04:29 +0700
Subject: [PATCH 03/11] =?UTF-8?q?Tracker:=20Issue=20List=20=E2=80=93=20Pri?=
=?UTF-8?q?ority=20presenter=20(#1382)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Artyom Grigorovich
---
packages/presentation/src/index.ts | 1 +
plugins/tracker-assets/lang/en.json | 1 +
plugins/tracker-assets/lang/ru.json | 1 +
.../src/components/CreateIssue.svelte | 11 +++-
.../src/components/PrioritySelector.svelte | 54 +++++++++++--------
.../issues/CategoryPresenter.svelte | 1 +
.../components/issues/IssuePresenter.svelte | 15 ++----
.../src/components/issues/Issues.svelte | 2 +-
.../src/components/issues/IssuesList.svelte | 52 ++++++++++++++----
.../issues/PriorityPresenter.svelte | 49 +++++++++++++++++
plugins/tracker-resources/src/index.ts | 2 +
plugins/tracker-resources/src/plugin.ts | 2 +
12 files changed, 145 insertions(+), 46 deletions(-)
create mode 100644 plugins/tracker-resources/src/components/issues/PriorityPresenter.svelte
diff --git a/packages/presentation/src/index.ts b/packages/presentation/src/index.ts
index d0aff88cd8..fc31f5d333 100644
--- a/packages/presentation/src/index.ts
+++ b/packages/presentation/src/index.ts
@@ -32,6 +32,7 @@ export { default as SpaceSelect } from './components/SpaceSelect.svelte'
export { default as UserBox } from './components/UserBox.svelte'
export { default as UserBoxList } from './components/UserBoxList.svelte'
export { default as UserInfo } from './components/UserInfo.svelte'
+export { default as UsersPopup } from './components/UsersPopup.svelte'
export { connect, versionError } from './connect'
export { default } from './plugin'
export * from './types'
diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json
index b69e3d3372..32c6d453af 100644
--- a/plugins/tracker-assets/lang/en.json
+++ b/plugins/tracker-assets/lang/en.json
@@ -26,6 +26,7 @@
"InProgress": "In Progress",
"Done": "Done",
"Canceled": "Canceled",
+ "SetPriority": "Set priority\u2026",
"SetStatus": "Set status\u2026",
"Priority": "Priority",
"NoPriority": "No priority",
diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json
index a29f26a786..b7211a4919 100644
--- a/plugins/tracker-assets/lang/ru.json
+++ b/plugins/tracker-assets/lang/ru.json
@@ -22,6 +22,7 @@
"InProgress": "В работе",
"Done": "Выполнено",
"Canceled": "Отменено",
+ "SetPriority": "Установить приоритет\u2026",
"SetStatus": "Установить статус\u2026",
"Priority": "Установить приоритет",
"NoPriority": "Нет приоритета",
diff --git a/plugins/tracker-resources/src/components/CreateIssue.svelte b/plugins/tracker-resources/src/components/CreateIssue.svelte
index 5be0352a9b..e3b6bfc781 100644
--- a/plugins/tracker-resources/src/components/CreateIssue.svelte
+++ b/plugins/tracker-resources/src/components/CreateIssue.svelte
@@ -91,7 +91,16 @@
{ icon: tracker.icon.DueDate, label: tracker.string.DueDate },
{ icon: tracker.icon.Parent, label: tracker.string.Parent }
]
+
let issueDate: number | null = null
+
+ const handlePriorityChanged = (newPriority: IssuePriority | undefined) => {
+ if (newPriority === undefined) {
+ return
+ }
+
+ object.priority = newPriority
+ }
@@ -127,7 +136,7 @@
-
+
-