diff --git a/models/chunter/src/actions.ts b/models/chunter/src/actions.ts index 4b33c7182f..cdc971bd19 100644 --- a/models/chunter/src/actions.ts +++ b/models/chunter/src/actions.ts @@ -206,6 +206,8 @@ function defineChannelActions (builder: Builder): void { query: { archived: false }, + override: [view.action.Archive], + visibilityTester: view.function.CanArchiveSpace, context: { mode: 'context', group: 'remove' diff --git a/models/core/src/migration.ts b/models/core/src/migration.ts index a7a9107b0d..8baa7860f5 100644 --- a/models/core/src/migration.ts +++ b/models/core/src/migration.ts @@ -285,7 +285,7 @@ export const coreOperation: MigrateOperation = { func: migrateAllSpaceToTyped }, { - state: 'add-spaces-owner', + state: 'add-spaces-owner-v1', func: migrateSpacesOwner }, { diff --git a/plugins/activity-resources/src/components/activity-info-message/ActivityInfoMessagePresenter.svelte b/plugins/activity-resources/src/components/activity-info-message/ActivityInfoMessagePresenter.svelte index 6dedf1234a..2e113ca483 100644 --- a/plugins/activity-resources/src/components/activity-info-message/ActivityInfoMessagePresenter.svelte +++ b/plugins/activity-resources/src/components/activity-info-message/ActivityInfoMessagePresenter.svelte @@ -41,6 +41,7 @@ export let hoverable = true export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover' export let hideLink = false + export let readonly: boolean = false export let onClick: (() => void) | undefined = undefined $: personAccount = $personAccountByIdStore.get((value.createdBy ?? value.modifiedBy) as Ref) @@ -74,6 +75,7 @@ {hoverable} {hoverStyles} viewlet={undefined} + {readonly} {onClick} > diff --git a/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte b/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte index 753fe0f5f8..a81e8ac830 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte @@ -39,6 +39,7 @@ export let videoPreload = true export let hideLink = false export let compact = false + export let readonly = false export let onClick: (() => void) | undefined = undefined const client = getClient() @@ -72,6 +73,7 @@ hideLink, type, compact, + readonly, onClick }} /> diff --git a/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte b/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte index 9578c9f193..91584a2b5f 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte @@ -61,6 +61,7 @@ export let type: ActivityMessageViewType = 'default' export let inlineActions: MessageInlineAction[] = [] export let excludedActions: Ref[] = [] + export let readonly: boolean = false export let onClick: (() => void) | undefined = undefined export let socialIcon: Asset | undefined = undefined @@ -107,8 +108,7 @@ $: isHidden = !!viewlet?.onlyWithParent && parentMessage === undefined $: withActionMenu = withActions && !embedded && (actions.length > 0 || menuActionIds.length > 0) - let readonly: boolean = false - $: readonly = $restrictionStore.disableComments + $: readonly = readonly || $restrictionStore.disableComments function canDisplayShort (type: ActivityMessageViewType, isSaved: boolean): boolean { return type === 'short' && !isSaved && (message.replies ?? 0) === 0 @@ -143,6 +143,7 @@ } function handleContextMenu (event: MouseEvent): void { + if (readonly) return const showCustomPopup = !isTextClicked(event.target as HTMLElement, event.clientX, event.clientY) if (showCustomPopup) { showMenu(event, { object: message, baseMenuClass: activity.class.ActivityMessage }, () => { diff --git a/plugins/activity-resources/src/components/activity-reference/ActivityReferencePresenter.svelte b/plugins/activity-resources/src/components/activity-reference/ActivityReferencePresenter.svelte index e4e267bde1..dcdb62e9a4 100644 --- a/plugins/activity-resources/src/components/activity-reference/ActivityReferencePresenter.svelte +++ b/plugins/activity-resources/src/components/activity-reference/ActivityReferencePresenter.svelte @@ -42,6 +42,7 @@ export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover' export let hideLink = false export let compact = false + export let readonly: boolean = false export let onClick: (() => void) | undefined = undefined const client = getClient() @@ -96,6 +97,7 @@ | undefined = undefined export let onClick: (() => void) | undefined = undefined @@ -195,6 +196,7 @@ {skipLabel} {hoverable} {hoverStyles} + {readonly} type={viewlet?.label || getIsTextType(attributeModel) ? 'default' : type} showDatePreposition={hideLink} {onClick} diff --git a/plugins/chunter-assets/lang/en.json b/plugins/chunter-assets/lang/en.json index 8412b7ca32..6edf462d0b 100644 --- a/plugins/chunter-assets/lang/en.json +++ b/plugins/chunter-assets/lang/en.json @@ -47,7 +47,7 @@ "Settings": "Settings", "ArchiveChannel": "Archive channel", "UnarchiveChannel": "Unarchive channel", - "ArchiveConfirm": "Do you want to archive channel?", + "ArchiveConfirm": "When you archive a channel, it’s archived for everyone.

No one will be able to send messages, but they’ll still have access to the channel’s history.

You’ll still be able to find the channel’s contents via search.
And you can always unarchive the channel in the future, if needed.\n", "UnarchiveConfirm": "Do you want to unarchive channel?", "AddToSaved": "Add to saved", "RemoveFromSaved": "Remove from saved", @@ -127,6 +127,8 @@ "Translate": "Translate", "ShowOriginal": "Show original", "Translating": "Translating...", - "StartConversation": "Start conversation" + "StartConversation": "Start conversation", + "ViewingThreadFromArchivedChannel": "You are viewing a thread from an archived channel", + "ViewingArchivedChannel": "You are viewing an archived channel" } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/es.json b/plugins/chunter-assets/lang/es.json index 027a3e2c10..e6cefc088f 100644 --- a/plugins/chunter-assets/lang/es.json +++ b/plugins/chunter-assets/lang/es.json @@ -47,7 +47,7 @@ "Settings": "Ajustes", "ArchiveChannel": "Archivar canal", "UnarchiveChannel": "Desarchivar canal", - "ArchiveConfirm": "¿Quieres archivar el canal?", + "ArchiveConfirm": "Cuando archivas un canal, se archiva para todos.

Nadie podrá enviar mensajes, pero seguirán teniendo acceso al historial del canal.

Todavía podrás encontrar el contenido del canal a través de la búsqueda.
Y siempre puedes desarchivar el canal en el futuro, si es necesario.\n", "UnarchiveConfirm": "¿Quieres desarchivar el canal?", "AddToSaved": "Añadir a guardados", "RemoveFromSaved": "Eliminar de guardados", @@ -127,6 +127,8 @@ "Translate": "Traducir", "ShowOriginal": "Mostrar original", "Translating": "Traduciendo...", - "StartConversation": "Iniciar conversación" + "StartConversation": "Iniciar conversación", + "ViewingThreadFromArchivedChannel": "Estás viendo un hilo de un canal archivado", + "ViewingArchivedChannel": "Estás viendo un canal archivado" } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/fr.json b/plugins/chunter-assets/lang/fr.json index f50055ed47..3004675c75 100644 --- a/plugins/chunter-assets/lang/fr.json +++ b/plugins/chunter-assets/lang/fr.json @@ -47,7 +47,7 @@ "Settings": "Paramètres", "ArchiveChannel": "Archiver le canal", "UnarchiveChannel": "Désarchiver le canal", - "ArchiveConfirm": "Voulez-vous archiver le canal ?", + "ArchiveConfirm": "Lorsque vous archivez un canal, il est archivé pour tout le monde.

Personne ne pourra envoyer de messages, mais ils auront toujours accès à l'historique du canal.

Vous pourrez toujours trouver le contenu du canal via la recherche.
Et vous pourrez toujours désarchiver le canal à l'avenir, si nécessaire.\n", "UnarchiveConfirm": "Voulez-vous désarchiver le canal ?", "AddToSaved": "Ajouter aux favoris", "RemoveFromSaved": "Retirer des favoris", @@ -127,6 +127,8 @@ "Translate": "Traduire", "ShowOriginal": "Afficher l'original", "Translating": "Traduction en cours...", - "StartConversation": "Démarrer la conversation" + "StartConversation": "Démarrer la conversation", + "ViewingThreadFromArchivedChannel": "Vous consultez un fil de discussion d'un canal archivé", + "ViewingArchivedChannel": "Vous consultez un canal archivé" } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/pt.json b/plugins/chunter-assets/lang/pt.json index fbfe71a7f0..41c7334b94 100644 --- a/plugins/chunter-assets/lang/pt.json +++ b/plugins/chunter-assets/lang/pt.json @@ -47,7 +47,7 @@ "Settings": "Definições", "ArchiveChannel": "Arquivar canal", "UnarchiveChannel": "Desarquivar canal", - "ArchiveConfirm": "Deseja arquivar o canal?", + "ArchiveConfirm": "Quando arquivar um canal, ele é arquivado para todos.

Ninguém poderá enviar mensagens, mas ainda terão acesso ao histórico do canal.

Ainda poderá encontrar o conteúdo do canal através da pesquisa.
E poderá sempre desarquivar o canal no futuro, se necessário.\n", "UnarchiveConfirm": "Deseja desarquivar o canal?", "AddToSaved": "Adicionar aos guardados", "RemoveFromSaved": "Remover dos guardados", @@ -127,6 +127,8 @@ "Translate": "Traduzir", "ShowOriginal": "Mostrar original", "Translating": "A traduzir...", - "StartConversation": "Iniciar conversa" + "StartConversation": "Iniciar conversa", + "ViewingThreadFromArchivedChannel": "Está a visualizar uma conversa em cadeia de um canal arquivado", + "ViewingArchivedChannel": "Está a visualizar um canal arquivado" } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/ru.json b/plugins/chunter-assets/lang/ru.json index febe44f00e..bf71bdf84f 100644 --- a/plugins/chunter-assets/lang/ru.json +++ b/plugins/chunter-assets/lang/ru.json @@ -47,7 +47,7 @@ "Settings": "Настройки", "ArchiveChannel": "Архивировать канал", "UnarchiveChannel": "Разархивировать канал", - "ArchiveConfirm": "Вы действительно хотите архивировать канал?", + "ArchiveConfirm": "При архивации канала он архивируется для всех.

Никто не сможет отправлять сообщения, но у них все равно будет доступ к истории канала.

Вы все равно сможете найти содержимое канала через поиск.
И вы всегда сможете разархивировать канал в будущем, если это понадобится.\n", "UnarchiveConfirm": "Вы действительно хотите разархивировать канал?", "AddToSaved": "Добавить в сохраненные", "RemoveFromSaved": "Удалить из сохраненных", @@ -127,6 +127,8 @@ "Translate": "Перевести", "ShowOriginal": "Показать оригинал", "Translating": "Перевод...", - "StartConversation": "Начать диалог" + "StartConversation": "Начать диалог", + "ViewingThreadFromArchivedChannel": "Вы просматриваете обсуждение из архивированного канала", + "ViewingArchivedChannel": "Вы просматриваете архивированный канал" } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/zh.json b/plugins/chunter-assets/lang/zh.json index 80bfc8c339..934f6c1fe9 100644 --- a/plugins/chunter-assets/lang/zh.json +++ b/plugins/chunter-assets/lang/zh.json @@ -47,7 +47,7 @@ "Settings": "设置", "ArchiveChannel": "归档频道", "UnarchiveChannel": "取消归档频道", - "ArchiveConfirm": "你想要归档频道吗?", + "ArchiveConfirm": "当你归档频道时,它会对所有人进行归档。

没有人能够发送消息,但他们仍然可以访问频道的历史记录。

你仍然可以通过搜索找到频道的内容。
如果需要,你可以随时取消归档频道。\n", "UnarchiveConfirm": "你想要取消归档频道吗?", "AddToSaved": "添加到已保存", "RemoveFromSaved": "从已保存中移除", @@ -127,6 +127,8 @@ "Translate": "翻译", "ShowOriginal": "显示原文", "Translating": "翻译中...", - "StartConversation": "开始对话" + "StartConversation": "开始对话", + "ViewingThreadFromArchivedChannel": "你正在查看已归档频道的线程", + "ViewingArchivedChannel": "你正在查看已归档频道" } } diff --git a/plugins/chunter-resources/src/components/Channel.svelte b/plugins/chunter-resources/src/components/Channel.svelte index b07c21d2df..ec2ff01215 100644 --- a/plugins/chunter-resources/src/components/Channel.svelte +++ b/plugins/chunter-resources/src/components/Channel.svelte @@ -103,6 +103,7 @@ {#if dataProvider} + + +{#if !readonly} +
+ +
+{:else} +
+ {#if isThread} +
+{/if} + + diff --git a/plugins/chunter-resources/src/components/ChannelMembers.svelte b/plugins/chunter-resources/src/components/ChannelMembers.svelte index a47a85600f..08d8747362 100644 --- a/plugins/chunter-resources/src/components/ChannelMembers.svelte +++ b/plugins/chunter-resources/src/components/ChannelMembers.svelte @@ -23,6 +23,7 @@ export let ids: Ref[] = [] export let disableRemoveFor: Ref[] = [] + export let readonly = false const dispatch = createEventDispatcher() @@ -36,22 +37,24 @@
-
- dispatch('add')} - /> -
+ {#if !readonly} +
+ dispatch('add')} + /> +
+ {/if} {#each persons as person, index (person._id)}
-
+
- {#if !disableRemoveFor.includes(person._id)} + {#if !readonly && !disableRemoveFor.includes(person._id)}
@@ -146,6 +147,7 @@ diff --git a/plugins/chunter-resources/src/components/chat/DocAside.svelte b/plugins/chunter-resources/src/components/chat/DocAside.svelte index ec7f6a64d4..d6bbbc8aaa 100644 --- a/plugins/chunter-resources/src/components/chat/DocAside.svelte +++ b/plugins/chunter-resources/src/components/chat/DocAside.svelte @@ -13,7 +13,7 @@ // limitations under the License. --> @@ -59,7 +61,7 @@ {object} ignoreKeys={objectChatPanel?.ignoreKeys ?? []} showHeader={false} - readonly={false} + {readonly} on:update />
diff --git a/plugins/chunter-resources/src/components/chat/create/CreateChannel.svelte b/plugins/chunter-resources/src/components/chat/create/CreateChannel.svelte index f9dfcab2bd..072ac9e19f 100644 --- a/plugins/chunter-resources/src/components/chat/create/CreateChannel.svelte +++ b/plugins/chunter-resources/src/components/chat/create/CreateChannel.svelte @@ -65,7 +65,8 @@ private: selectedVisibilityId === 'private', archived: false, members: [account._id], - topic: description + topic: description, + owners: [account._id] }) openChannel(channelId, chunter.class.Channel) diff --git a/plugins/chunter-resources/src/components/chat/navigator/ChatNavGroup.svelte b/plugins/chunter-resources/src/components/chat/navigator/ChatNavGroup.svelte index e174e3426c..2dd34f1d21 100644 --- a/plugins/chunter-resources/src/components/chat/navigator/ChatNavGroup.svelte +++ b/plugins/chunter-resources/src/components/chat/navigator/ChatNavGroup.svelte @@ -39,7 +39,6 @@ const client = getClient() const hierarchy = client.getHierarchy() const inboxClient = InboxNotificationsClientImpl.getClient() - const contextByDocStore = inboxClient.contextByDoc const contextsStore = inboxClient.contexts const objectsQueryByClass = new Map>, { query: LiveQuery, limit: number }>() @@ -70,18 +69,17 @@ sections = res }) - $: shouldPushObject = - object !== undefined && getObjectGroup(object) === model.id && !$contextByDocStore.has(object._id) + $: shouldPushObject = object !== undefined && getObjectGroup(object) === model.id function loadObjects (contexts: DocNotifyContext[]): void { const contextsByClass = groupByArray(contexts, ({ objectClass }) => objectClass) for (const [_class, ctx] of contextsByClass.entries()) { - const isChunterSpace = hierarchy.isDerived(_class, chunter.class.ChunterSpace) + const isSpace = hierarchy.isDerived(_class, core.class.Space) const ids = ctx.map(({ objectId }) => objectId) const { query, limit } = objectsQueryByClass.get(_class) ?? { query: createQuery(), - limit: isChunterSpace ? -1 : model.maxSectionItems ?? 5 + limit: isSpace ? -1 : model.maxSectionItems ?? 5 } objectsQueryByClass.set(_class, { query, limit: limit ?? model.maxSectionItems ?? 5 }) @@ -90,7 +88,7 @@ _class, { _id: { $in: limit !== -1 ? ids.slice(0, limit) : ids }, - ...(isChunterSpace ? { space: core.space.Space } : {}) + ...(isSpace ? { space: core.space.Space, archived: false } : {}) }, (res) => { objectsByClass = objectsByClass.set(_class, { docs: res, total: res.total }) diff --git a/plugins/chunter-resources/src/components/threads/ThreadContent.svelte b/plugins/chunter-resources/src/components/threads/ThreadContent.svelte index cb11b0bab6..827da56d96 100644 --- a/plugins/chunter-resources/src/components/threads/ThreadContent.svelte +++ b/plugins/chunter-resources/src/components/threads/ThreadContent.svelte @@ -3,15 +3,31 @@ import ThreadParentMessage from './ThreadParentPresenter.svelte' import { Label } from '@hcengineering/ui' import ChannelScrollView from '../ChannelScrollView.svelte' - import { Ref } from '@hcengineering/core' + import core, { Doc, Ref, Space } from '@hcengineering/core' + import { createQuery, getClient } from '@hcengineering/presentation' + import { ChannelDataProvider } from '../../channelDataProvider' import chunter from '../../plugin' export let selectedMessageId: Ref | undefined = undefined export let message: ActivityMessage + const query = createQuery() + const client = getClient() + const hierarchy = client.getHierarchy() + + let channel: Doc | undefined = undefined let dataProvider: ChannelDataProvider | undefined = undefined + $: query.query( + message.attachedToClass, + { _id: message.attachedTo }, + (res) => { + channel = res[0] + }, + { limit: 1 } + ) + $: if (message !== undefined && dataProvider === undefined) { dataProvider = new ChannelDataProvider( undefined, @@ -24,22 +40,26 @@ } $: messagesStore = dataProvider?.messagesStore + $: readonly = hierarchy.isDerived(message.attachedToClass, core.class.Space) + ? (channel as Space)?.archived ?? false + : false
- {#if dataProvider !== undefined} + {#if dataProvider !== undefined && channel !== undefined}
- +
{#if (message.replies ?? $messagesStore?.length ?? 0) > 0} diff --git a/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte b/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte index 92ba927104..f5ad7de713 100644 --- a/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte +++ b/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte @@ -39,6 +39,7 @@ export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover' export let attachmentImageSize: AttachmentImageSize = 'x-large' export let videoPreload = true + export let readonly = false export let onClick: (() => void) | undefined = undefined const client = getClient() @@ -74,5 +75,6 @@ {attachmentImageSize} {videoPreload} {onClick} + {readonly} /> {/if} diff --git a/plugins/chunter-resources/src/components/threads/ThreadParentPresenter.svelte b/plugins/chunter-resources/src/components/threads/ThreadParentPresenter.svelte index c0436d5e95..bc6a07ab20 100644 --- a/plugins/chunter-resources/src/components/threads/ThreadParentPresenter.svelte +++ b/plugins/chunter-resources/src/components/threads/ThreadParentPresenter.svelte @@ -17,6 +17,7 @@ import { ActivityMessage } from '@hcengineering/activity' export let message: ActivityMessage + export let readonly = false diff --git a/plugins/chunter-resources/src/index.ts b/plugins/chunter-resources/src/index.ts index 64da477902..864a1e0ef1 100644 --- a/plugins/chunter-resources/src/index.ts +++ b/plugins/chunter-resources/src/index.ts @@ -92,6 +92,7 @@ export async function ArchiveChannel (channel: Channel, evt: any, props?: { afte showPopup(MessageBox, { label: chunter.string.ArchiveChannel, message: chunter.string.ArchiveConfirm, + richMessage: true, action: async () => { const client = getClient() diff --git a/plugins/chunter/src/index.ts b/plugins/chunter/src/index.ts index 662ea1e23d..d18ba22c82 100644 --- a/plugins/chunter/src/index.ts +++ b/plugins/chunter/src/index.ts @@ -215,7 +215,9 @@ export default plugin(chunterId, { Translate: '' as IntlString, ShowOriginal: '' as IntlString, Translating: '' as IntlString, - StartConversation: '' as IntlString + StartConversation: '' as IntlString, + ViewingThreadFromArchivedChannel: '' as IntlString, + ViewingArchivedChannel: '' as IntlString }, ids: { DMNotification: '' as Ref,