mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-16 21:35:10 +00:00
Move reply to thread to quick actions (#4603)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
parent
19c1edf719
commit
318f4eab1a
@ -630,21 +630,6 @@ export function createModel (builder: Builder, options = { addApplication: true
|
|||||||
chunter.action.DeleteChatMessage
|
chunter.action.DeleteChatMessage
|
||||||
)
|
)
|
||||||
|
|
||||||
createAction(
|
|
||||||
builder,
|
|
||||||
{
|
|
||||||
action: chunter.actionImpl.ReplyToThread,
|
|
||||||
label: chunter.string.ReplyToThread,
|
|
||||||
icon: chunter.icon.Thread,
|
|
||||||
input: 'focus',
|
|
||||||
category: chunter.category.Chunter,
|
|
||||||
target: activity.class.ActivityMessage,
|
|
||||||
visibilityTester: chunter.function.CanReplyToThread,
|
|
||||||
context: { mode: 'context', application: notification.app.Notification, group: 'edit' }
|
|
||||||
},
|
|
||||||
chunter.action.ReplyToThread
|
|
||||||
)
|
|
||||||
|
|
||||||
createAction(
|
createAction(
|
||||||
builder,
|
builder,
|
||||||
{
|
{
|
||||||
@ -694,6 +679,21 @@ export function createModel (builder: Builder, options = { addApplication: true
|
|||||||
components: [{ kind: 'footer', component: chunter.component.Replies }]
|
components: [{ kind: 'footer', component: chunter.component.Replies }]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
builder.createDoc(activity.class.ActivityMessageExtension, core.space.Model, {
|
||||||
|
ofMessage: chunter.class.ChatMessage,
|
||||||
|
components: [{ kind: 'action', component: chunter.component.ReplyToThreadAction }]
|
||||||
|
})
|
||||||
|
|
||||||
|
builder.createDoc(activity.class.ActivityMessageExtension, core.space.Model, {
|
||||||
|
ofMessage: activity.class.DocUpdateMessage,
|
||||||
|
components: [{ kind: 'action', component: chunter.component.ReplyToThreadAction }]
|
||||||
|
})
|
||||||
|
|
||||||
|
builder.createDoc(activity.class.ActivityMessageExtension, core.space.Model, {
|
||||||
|
ofMessage: activity.class.ActivityInfoMessage,
|
||||||
|
components: [{ kind: 'action', component: chunter.component.ReplyToThreadAction }]
|
||||||
|
})
|
||||||
|
|
||||||
builder.mixin(chunter.class.Channel, core.class.Class, chunter.mixin.ObjectChatPanel, {
|
builder.mixin(chunter.class.Channel, core.class.Class, chunter.mixin.ObjectChatPanel, {
|
||||||
ignoreKeys: ['archived', 'collaborators', 'lastMessage', 'pinned', 'topic', 'description']
|
ignoreKeys: ['archived', 'collaborators', 'lastMessage', 'pinned', 'topic', 'description']
|
||||||
})
|
})
|
||||||
|
@ -48,8 +48,7 @@ export default mergeIds(chunterId, chunter, {
|
|||||||
ArchiveChannel: '' as ViewAction,
|
ArchiveChannel: '' as ViewAction,
|
||||||
UnarchiveChannel: '' as ViewAction,
|
UnarchiveChannel: '' as ViewAction,
|
||||||
ConvertDmToPrivateChannel: '' as ViewAction,
|
ConvertDmToPrivateChannel: '' as ViewAction,
|
||||||
DeleteChatMessage: '' as ViewAction,
|
DeleteChatMessage: '' as ViewAction
|
||||||
ReplyToThread: '' as ViewAction
|
|
||||||
},
|
},
|
||||||
category: {
|
category: {
|
||||||
Chunter: '' as Ref<ActionCategory>
|
Chunter: '' as Ref<ActionCategory>
|
||||||
@ -106,7 +105,6 @@ export default mergeIds(chunterId, chunter, {
|
|||||||
GetFragment: '' as Resource<(doc: Doc, props: Record<string, any>) => Promise<Location>>,
|
GetFragment: '' as Resource<(doc: Doc, props: Record<string, any>) => Promise<Location>>,
|
||||||
DmIdentifierProvider: '' as Resource<<T extends Doc>(client: Client, ref: Ref<T>, doc?: T) => Promise<string>>,
|
DmIdentifierProvider: '' as Resource<<T extends Doc>(client: Client, ref: Ref<T>, doc?: T) => Promise<string>>,
|
||||||
CanDeleteMessage: '' as Resource<(doc?: Doc | Doc[]) => Promise<boolean>>,
|
CanDeleteMessage: '' as Resource<(doc?: Doc | Doc[]) => Promise<boolean>>,
|
||||||
CanReplyToThread: '' as Resource<(doc?: Doc | Doc[]) => Promise<boolean>>,
|
|
||||||
CanCopyMessageLink: '' as Resource<(doc?: Doc | Doc[]) => Promise<boolean>>,
|
CanCopyMessageLink: '' as Resource<(doc?: Doc | Doc[]) => Promise<boolean>>,
|
||||||
GetChunterSpaceLinkFragment: '' as Resource<(doc: Doc, props: Record<string, any>) => Promise<Location>>,
|
GetChunterSpaceLinkFragment: '' as Resource<(doc: Doc, props: Record<string, any>) => Promise<Location>>,
|
||||||
GetThreadLink: '' as Resource<(doc: Doc, props: Record<string, any>) => Promise<Location>>
|
GetThreadLink: '' as Resource<(doc: Doc, props: Record<string, any>) => Promise<Location>>
|
||||||
|
@ -66,9 +66,9 @@
|
|||||||
<div class="root">
|
<div class="root">
|
||||||
{#if withFlatActions}
|
{#if withFlatActions}
|
||||||
<AddReactionAction object={message} on:open on:close />
|
<AddReactionAction object={message} on:open on:close />
|
||||||
|
<ActivityMessageExtensionComponent kind="action" {extensions} props={{ object: message }} on:close on:open />
|
||||||
<PinMessageAction object={message} />
|
<PinMessageAction object={message} />
|
||||||
<SaveMessageAction object={message} />
|
<SaveMessageAction object={message} />
|
||||||
<ActivityMessageExtensionComponent kind="action" {extensions} props={{ object: message }} on:close on:open />
|
|
||||||
{/if}
|
{/if}
|
||||||
{#if withActionMenu}
|
{#if withActionMenu}
|
||||||
<ActivityMessageAction icon={IconMoreV} action={showMenu} opened={isActionMenuOpened} />
|
<ActivityMessageAction icon={IconMoreV} action={showMenu} opened={isActionMenuOpened} />
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<!--
|
||||||
|
// 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 { ActivityMessage } from '@hcengineering/activity'
|
||||||
|
import { ActivityMessageAction } from '@hcengineering/activity-resources'
|
||||||
|
|
||||||
|
import chunter from './../plugin'
|
||||||
|
import { replyToThread } from '../index'
|
||||||
|
import { canReplyToThread } from '../utils'
|
||||||
|
|
||||||
|
export let object: ActivityMessage
|
||||||
|
|
||||||
|
function onReply (): void {
|
||||||
|
replyToThread(object)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if canReplyToThread(object)}
|
||||||
|
<ActivityMessageAction size="x-small" icon={chunter.icon.Thread} action={onReply} />
|
||||||
|
{/if}
|
@ -68,13 +68,13 @@ import ThreadNotificationPresenter from './components/notification/ThreadNotific
|
|||||||
import ChatMessageNotificationLabel from './components/notification/ChatMessageNotificationLabel.svelte'
|
import ChatMessageNotificationLabel from './components/notification/ChatMessageNotificationLabel.svelte'
|
||||||
import ChatAside from './components/chat/ChatAside.svelte'
|
import ChatAside from './components/chat/ChatAside.svelte'
|
||||||
import Replies from './components/Replies.svelte'
|
import Replies from './components/Replies.svelte'
|
||||||
|
import ReplyToThreadAction from './components/ReplyToThreadAction.svelte'
|
||||||
|
|
||||||
import { updateBacklinksList } from './backlinks'
|
import { updateBacklinksList } from './backlinks'
|
||||||
import {
|
import {
|
||||||
ChannelTitleProvider,
|
ChannelTitleProvider,
|
||||||
DirectTitleProvider,
|
DirectTitleProvider,
|
||||||
canDeleteMessage,
|
canDeleteMessage,
|
||||||
canReplyToThread,
|
|
||||||
chunterSpaceLinkFragmentProvider,
|
chunterSpaceLinkFragmentProvider,
|
||||||
dmIdentifierProvider,
|
dmIdentifierProvider,
|
||||||
getDmName,
|
getDmName,
|
||||||
@ -284,7 +284,8 @@ export default async (): Promise<Resources> => ({
|
|||||||
ChatMessageNotificationLabel,
|
ChatMessageNotificationLabel,
|
||||||
ThreadNotificationPresenter,
|
ThreadNotificationPresenter,
|
||||||
ChatAside,
|
ChatAside,
|
||||||
Replies
|
Replies,
|
||||||
|
ReplyToThreadAction
|
||||||
},
|
},
|
||||||
function: {
|
function: {
|
||||||
GetDmName: getDmName,
|
GetDmName: getDmName,
|
||||||
@ -295,7 +296,6 @@ export default async (): Promise<Resources> => ({
|
|||||||
ChannelTitleProvider,
|
ChannelTitleProvider,
|
||||||
DmIdentifierProvider: dmIdentifierProvider,
|
DmIdentifierProvider: dmIdentifierProvider,
|
||||||
CanDeleteMessage: canDeleteMessage,
|
CanDeleteMessage: canDeleteMessage,
|
||||||
CanReplyToThread: canReplyToThread,
|
|
||||||
CanCopyMessageLink: canCopyMessageLink,
|
CanCopyMessageLink: canCopyMessageLink,
|
||||||
GetChunterSpaceLinkFragment: chunterSpaceLinkFragmentProvider,
|
GetChunterSpaceLinkFragment: chunterSpaceLinkFragmentProvider,
|
||||||
GetUnreadThreadsCount: getUnreadThreadsCount,
|
GetUnreadThreadsCount: getUnreadThreadsCount,
|
||||||
@ -310,8 +310,7 @@ export default async (): Promise<Resources> => ({
|
|||||||
ConvertDmToPrivateChannel,
|
ConvertDmToPrivateChannel,
|
||||||
DeleteChatMessage: deleteChatMessage,
|
DeleteChatMessage: deleteChatMessage,
|
||||||
OpenChannel,
|
OpenChannel,
|
||||||
UnpinAllChannels,
|
UnpinAllChannels
|
||||||
ReplyToThread: replyToThread
|
|
||||||
},
|
},
|
||||||
backreference: {
|
backreference: {
|
||||||
Update: update
|
Update: update
|
||||||
|
@ -119,7 +119,7 @@ export async function canDeleteMessage (doc?: ChatMessage): Promise<boolean> {
|
|||||||
return doc.createdBy === me._id
|
return doc.createdBy === me._id
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function canReplyToThread (doc?: ActivityMessage): Promise<boolean> {
|
export function canReplyToThread (doc?: ActivityMessage): boolean {
|
||||||
if (doc === undefined) {
|
if (doc === undefined) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -400,7 +400,6 @@ export function buildThreadLink (loc: Location, contextId: Ref<DocNotifyContext>
|
|||||||
loc.path[3] = contextId
|
loc.path[3] = contextId
|
||||||
loc.path[4] = _id
|
loc.path[4] = _id
|
||||||
loc.fragment = undefined
|
loc.fragment = undefined
|
||||||
loc.query = { message: _id }
|
|
||||||
|
|
||||||
return loc
|
return loc
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,8 @@ export default plugin(chunterId, {
|
|||||||
ChatMessagePresenter: '' as AnyComponent,
|
ChatMessagePresenter: '' as AnyComponent,
|
||||||
ThreadMessagePresenter: '' as AnyComponent,
|
ThreadMessagePresenter: '' as AnyComponent,
|
||||||
ChatAside: '' as AnyComponent,
|
ChatAside: '' as AnyComponent,
|
||||||
Replies: '' as AnyComponent
|
Replies: '' as AnyComponent,
|
||||||
|
ReplyToThreadAction: '' as AnyComponent
|
||||||
},
|
},
|
||||||
class: {
|
class: {
|
||||||
Message: '' as Ref<Class<Message>>,
|
Message: '' as Ref<Class<Message>>,
|
||||||
@ -251,7 +252,6 @@ export default plugin(chunterId, {
|
|||||||
},
|
},
|
||||||
action: {
|
action: {
|
||||||
DeleteChatMessage: '' as Ref<Action>,
|
DeleteChatMessage: '' as Ref<Action>,
|
||||||
ReplyToThread: '' as Ref<Action>,
|
|
||||||
OpenChannel: '' as Ref<Action>
|
OpenChannel: '' as Ref<Action>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user