mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
ezqms-966: notifications fixes (#5819)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
1ce1eecf16
commit
45b24722df
@ -926,6 +926,11 @@ export function defineNotifications (builder: Builder): void {
|
||||
[notification.providers.PlatformNotification]: true,
|
||||
[notification.providers.BrowserNotification]: false,
|
||||
[notification.providers.EmailNotification]: false
|
||||
},
|
||||
templates: {
|
||||
textTemplate: '{sender} changed {doc} status',
|
||||
htmlTemplate: '<p>{sender} changed {doc} status</p>',
|
||||
subjectTemplate: '{doc} status changed'
|
||||
}
|
||||
},
|
||||
documents.notification.StateNotification
|
||||
@ -941,12 +946,17 @@ export function defineNotifications (builder: Builder): void {
|
||||
label: documents.string.CoAuthors,
|
||||
group: documents.notification.DocumentsNotificationGroup,
|
||||
field: 'coAuthors',
|
||||
txClasses: [core.class.TxUpdateDoc],
|
||||
txClasses: [core.class.TxCreateDoc, core.class.TxUpdateDoc],
|
||||
objectClass: documents.class.ControlledDocument,
|
||||
providers: {
|
||||
[notification.providers.PlatformNotification]: true,
|
||||
[notification.providers.BrowserNotification]: false,
|
||||
[notification.providers.EmailNotification]: false
|
||||
[notification.providers.BrowserNotification]: true,
|
||||
[notification.providers.EmailNotification]: true
|
||||
},
|
||||
templates: {
|
||||
textTemplate: '{sender} assigned you as a co-author of {doc}',
|
||||
htmlTemplate: '<p>{sender} assigned you as a co-author of {doc}</p>',
|
||||
subjectTemplate: 'Co-authoring assignment for {doc}'
|
||||
}
|
||||
},
|
||||
documents.notification.CoAuthorsNotification
|
||||
@ -978,7 +988,7 @@ export function defineNotifications (builder: Builder): void {
|
||||
'changeControl',
|
||||
'coAuthors'
|
||||
],
|
||||
['owner']
|
||||
['owner', 'comments', 'reviewers', 'approvers']
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,6 @@ export class TDocument extends TDoc implements Document {
|
||||
state!: DocumentState
|
||||
|
||||
@Prop(TypeCollaborativeDoc(), documents.string.CollaborativeDocument)
|
||||
@Hidden()
|
||||
content!: CollaborativeDoc
|
||||
|
||||
@Prop(Collection(tags.class.TagReference), documents.string.Labels)
|
||||
|
@ -93,7 +93,6 @@ export class TDocument extends TAttachedDoc implements Document {
|
||||
name!: string
|
||||
|
||||
@Prop(TypeCollaborativeDoc(), document.string.Document)
|
||||
@Hidden()
|
||||
content!: CollaborativeDoc
|
||||
|
||||
@Prop(TypeRef(core.class.Account), document.string.LockedBy)
|
||||
|
@ -135,9 +135,14 @@ export function createModel (builder: Builder): void {
|
||||
label: request.string.Request,
|
||||
allowedForAuthor: true,
|
||||
providers: {
|
||||
[notification.providers.BrowserNotification]: false,
|
||||
[notification.providers.BrowserNotification]: true,
|
||||
[notification.providers.PlatformNotification]: true,
|
||||
[notification.providers.EmailNotification]: false
|
||||
[notification.providers.EmailNotification]: true
|
||||
},
|
||||
templates: {
|
||||
textTemplate: '{sender} sent you a {doc}',
|
||||
htmlTemplate: '<p><b>{sender}</b> sent you a {doc}</p>',
|
||||
subjectTemplate: '{doc}'
|
||||
}
|
||||
},
|
||||
request.ids.CreateRequestNotification
|
||||
|
@ -33,6 +33,8 @@
|
||||
"@hcengineering/model-core": "^0.6.0",
|
||||
"@hcengineering/platform": "^0.6.11",
|
||||
"@hcengineering/server-request": "^0.6.0",
|
||||
"@hcengineering/server-core": "^0.6.1"
|
||||
"@hcengineering/server-core": "^0.6.1",
|
||||
"@hcengineering/model-request": "^0.6.0",
|
||||
"@hcengineering/server-notification": "^0.6.1"
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ import { type Builder } from '@hcengineering/model'
|
||||
import core from '@hcengineering/core'
|
||||
import serverCore from '@hcengineering/server-core'
|
||||
import serverRequest from '@hcengineering/server-request'
|
||||
import serverNotification from '@hcengineering/server-notification'
|
||||
import request from '@hcengineering/model-request'
|
||||
|
||||
export { serverRequestId } from '@hcengineering/server-request'
|
||||
|
||||
@ -25,4 +27,8 @@ export function createModel (builder: Builder): void {
|
||||
builder.createDoc(serverCore.class.Trigger, core.space.Model, {
|
||||
trigger: serverRequest.trigger.OnRequest
|
||||
})
|
||||
|
||||
builder.mixin(request.class.Request, core.class.Class, serverNotification.mixin.TextPresenter, {
|
||||
presenter: serverRequest.function.RequestTextPresenter
|
||||
})
|
||||
}
|
||||
|
@ -500,6 +500,10 @@ export function createModel (builder: Builder): void {
|
||||
editor: view.component.CollaborativeDocEditor
|
||||
})
|
||||
|
||||
builder.mixin(core.class.TypeCollaborativeDoc, core.class.Class, view.mixin.ActivityAttributePresenter, {
|
||||
presenter: view.component.CollaborativeDocActivityPresenter
|
||||
})
|
||||
|
||||
builder.mixin(core.class.TypeCollaborativeDocVersion, core.class.Class, view.mixin.InlineAttributEditor, {
|
||||
editor: view.component.CollaborativeDocEditor
|
||||
})
|
||||
|
@ -74,6 +74,7 @@ export default mergeIds(viewId, view, {
|
||||
HTMLEditor: '' as AnyComponent,
|
||||
CollaborativeHTMLEditor: '' as AnyComponent,
|
||||
CollaborativeDocEditor: '' as AnyComponent,
|
||||
CollaborativeDocActivityPresenter: '' as AnyComponent,
|
||||
MarkupEditor: '' as AnyComponent,
|
||||
MarkupEditorPopup: '' as AnyComponent,
|
||||
ListView: '' as AnyComponent,
|
||||
|
@ -138,7 +138,8 @@ export function getIsTextType (attributeModel?: AttributeModel): boolean {
|
||||
|
||||
return (
|
||||
attributeModel.attribute?.type?._class === core.class.TypeMarkup ||
|
||||
attributeModel.attribute?.type?._class === core.class.TypeCollaborativeMarkup
|
||||
attributeModel.attribute?.type?._class === core.class.TypeCollaborativeMarkup ||
|
||||
attributeModel.attribute?.type?._class === core.class.TypeCollaborativeDoc
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@
|
||||
<div class="label mr-1">
|
||||
<Label label={documents.string.CoAuthors} />
|
||||
</div>
|
||||
{reviewers?.length}
|
||||
{coAuthors?.length}
|
||||
</div>
|
||||
<div class="flex-col mt-4">
|
||||
<UserBoxItems
|
||||
|
@ -0,0 +1,21 @@
|
||||
<!--
|
||||
// Copyright © 2024 Hardcore Engineering Inc.
|
||||
//
|
||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License. You may
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { CollaborativeDoc } from '@hcengineering/core'
|
||||
|
||||
export let value: CollaborativeDoc
|
||||
</script>
|
||||
|
||||
<span>{value}</span>
|
@ -28,6 +28,7 @@ import ClassPresenter from './components/ClassPresenter.svelte'
|
||||
import ClassRefPresenter from './components/ClassRefPresenter.svelte'
|
||||
import CollaborativeDocEditor from './components/CollaborativeDocEditor.svelte'
|
||||
import CollaborativeHTMLEditor from './components/CollaborativeHTMLEditor.svelte'
|
||||
import CollaborativeDocActivityPresenter from './components/CollaborativeDocActivityPresenter.svelte'
|
||||
import ColorsPopup from './components/ColorsPopup.svelte'
|
||||
import DateEditor from './components/DateEditor.svelte'
|
||||
import DatePresenter from './components/DatePresenter.svelte'
|
||||
@ -275,6 +276,7 @@ export default async (): Promise<Resources> => ({
|
||||
HTMLEditor,
|
||||
CollaborativeDocEditor,
|
||||
CollaborativeHTMLEditor,
|
||||
CollaborativeDocActivityPresenter,
|
||||
ListView,
|
||||
GrowPresenter,
|
||||
DividerPresenter,
|
||||
|
@ -15,11 +15,12 @@
|
||||
|
||||
import core, { Doc, Tx, TxCUD, TxCollectionCUD, TxCreateDoc, TxUpdateDoc, TxProcessor } from '@hcengineering/core'
|
||||
import request, { Request, RequestStatus } from '@hcengineering/request'
|
||||
import { getResource, translate } from '@hcengineering/platform'
|
||||
import type { TriggerControl } from '@hcengineering/server-core'
|
||||
import { pushDocUpdateMessages } from '@hcengineering/server-activity-resources'
|
||||
import { DocUpdateMessage } from '@hcengineering/activity'
|
||||
import notification from '@hcengineering/notification'
|
||||
import { getNotificationTxes, getCollaborators } from '@hcengineering/server-notification-resources'
|
||||
import { getNotificationTxes, getCollaborators, getTextPresenter } from '@hcengineering/server-notification-resources'
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -158,8 +159,31 @@ async function getRequestNotificationTx (tx: TxCollectionCUD<Doc, Request>, cont
|
||||
return res
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export async function requestTextPresenter (doc: Doc, control: TriggerControl): Promise<string> {
|
||||
const request = doc as Request
|
||||
let title = await translate(control.hierarchy.getClass(request._class).label, {})
|
||||
|
||||
const attachedDocTextPresenter = getTextPresenter(request.attachedToClass, control.hierarchy)
|
||||
if (attachedDocTextPresenter !== undefined) {
|
||||
const getTitle = await getResource(attachedDocTextPresenter.presenter)
|
||||
const attachedDoc = (await control.findAll(request.attachedToClass, { _id: request.attachedTo }, { limit: 1 }))[0]
|
||||
|
||||
if (attachedDoc !== undefined) {
|
||||
title = `${title} — ${await getTitle(attachedDoc, control)}`
|
||||
}
|
||||
}
|
||||
|
||||
return title
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
export default async () => ({
|
||||
function: {
|
||||
RequestTextPresenter: requestTextPresenter
|
||||
},
|
||||
trigger: {
|
||||
OnRequest
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@hcengineering/platform": "^0.6.11",
|
||||
"@hcengineering/server-core": "^0.6.1"
|
||||
"@hcengineering/server-core": "^0.6.1",
|
||||
"@hcengineering/server-notification": "^0.6.1"
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
import { Plugin, plugin, Resource } from '@hcengineering/platform'
|
||||
import type { TriggerFunc } from '@hcengineering/server-core'
|
||||
import { Presenter } from '@hcengineering/server-notification'
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -25,6 +26,9 @@ export const serverRequestId = 'server-request' as Plugin
|
||||
* @public
|
||||
*/
|
||||
export default plugin(serverRequestId, {
|
||||
function: {
|
||||
RequestTextPresenter: '' as Resource<Presenter>
|
||||
},
|
||||
trigger: {
|
||||
OnRequest: '' as Resource<TriggerFunc>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user