Skip to content

Commit 1e31f25

Browse files
Fix user mention icon and link previews (#9635)
1 parent 6b95725 commit 1e31f25

File tree

5 files changed

+11
-16
lines changed

5 files changed

+11
-16
lines changed

packages/presentation/src/components/markup/ObjectNode.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@
3636
const withoutDoc: Ref<Doc>[] = [contact.mention.Here, contact.mention.Everyone]
3737
3838
$: icon =
39-
_class !== undefined && hierarchy.hasClass(_class) && !withoutDoc.includes(_id as any)
39+
_class !== undefined &&
40+
hierarchy.hasClass(_class) &&
41+
!withoutDoc.includes(_id as any) &&
42+
!hierarchy.isDerived(_class, contact.class.Contact)
4043
? hierarchy.getClass(_class).icon
4144
: null
4245

plugins/communication-resources/src/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import { isCardAllowedForCommunications, showForbidden, toggleReaction, toMarkup
4545
import { isMessageTranslating, messageEditingStore, threadCreateMessageStore, translateMessagesStore } from './stores'
4646

4747
export const addReaction: MessageActionFunction = async (message, card: Card, evt, onOpen, onClose) => {
48-
if (!(await isCardAllowedForCommunications(card))) {
48+
if (!isCardAllowedForCommunications(card)) {
4949
await showForbidden()
5050
return
5151
}
@@ -68,7 +68,7 @@ export const addReaction: MessageActionFunction = async (message, card: Card, ev
6868
}
6969

7070
export const replyInThread: MessageActionFunction = async (message: Message, parentCard: Card): Promise<void> => {
71-
if (!(await isCardAllowedForCommunications(parentCard))) {
71+
if (!isCardAllowedForCommunications(parentCard)) {
7272
await showForbidden()
7373
return
7474
}

plugins/communication-resources/src/components/message/MessageInput.svelte

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
export let message: Message | undefined = undefined
6464
export let title: string = ''
6565
export let onCancel: (() => void) | undefined = undefined
66-
export let onSubmit: ((markdown: string, blobs: BlobParams[]) => Promise<void>) | undefined = undefined
6766
6867
const throttle = new ThrottledCaller(500)
6968
const dispatch = createEventDispatcher()
@@ -111,14 +110,14 @@
111110
}
112111
113112
async function handleSubmit (event: CustomEvent<Markup>): Promise<void> {
114-
if (!(await isCardAllowedForCommunications(card))) {
113+
event.preventDefault()
114+
event.stopPropagation()
115+
116+
if (!isCardAllowedForCommunications(card)) {
115117
await showForbidden()
116118
return
117119
}
118120
119-
event.preventDefault()
120-
event.stopPropagation()
121-
122121
const markup = event.detail
123122
const blobsToLoad = draft.blobs
124123
const linksToLoad = draft.links
@@ -133,11 +132,6 @@
133132
134133
const markdown = toMarkdown(markup)
135134
136-
if (onSubmit !== undefined) {
137-
await onSubmit(markdown, blobsToLoad)
138-
return
139-
}
140-
141135
if (message === undefined) {
142136
await createMessage(markdown, blobsToLoad, linksToLoad, urlsToLoad, appletsToLoad)
143137
dispatch('sent')

plugins/communication-resources/src/components/message/MessagePresenter.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
} from '../../stores'
3636
import { getMessageActions } from '../../actions'
3737
import communication from '../../plugin'
38-
import { isBlobAttachment } from '@hcengineering/communication-shared'
39-
import { getCommunicationClient } from '@hcengineering/presentation'
4038
4139
export let card: Card
4240
export let message: Message

plugins/communication-resources/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export async function loadLinkPreviewParams (url: string): Promise<LinkPreviewPa
138138
}
139139
}
140140

141-
export async function isCardAllowedForCommunications (card: Card): Promise<boolean> {
141+
export function isCardAllowedForCommunications (card: Card): boolean {
142142
if (getCurrentAccount().role !== AccountRole.Guest) return true
143143
const allowedCards = get(guestCommunicationAllowedCards)
144144
if (allowedCards.includes(card._id)) return true

0 commit comments

Comments
 (0)