mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
Chunter: archive channel (#1416)
Signed-off-by: budaeva <irina.budaeva@xored.com>
This commit is contained in:
parent
3240cac4df
commit
5cd7771257
@ -161,6 +161,44 @@ export function createModel (builder: Builder): void {
|
|||||||
action: chunter.action.MarkUnread
|
action: chunter.action.MarkUnread
|
||||||
})
|
})
|
||||||
|
|
||||||
|
builder.createDoc(
|
||||||
|
view.class.Action,
|
||||||
|
core.space.Model,
|
||||||
|
{
|
||||||
|
label: chunter.string.ArchiveChannel,
|
||||||
|
icon: view.icon.Archive,
|
||||||
|
action: chunter.actionImpl.ArchiveChannel
|
||||||
|
},
|
||||||
|
chunter.action.ArchiveChannel
|
||||||
|
)
|
||||||
|
|
||||||
|
builder.createDoc(
|
||||||
|
view.class.Action,
|
||||||
|
core.space.Model,
|
||||||
|
{
|
||||||
|
label: chunter.string.UnarchiveChannel,
|
||||||
|
icon: view.icon.Archive,
|
||||||
|
action: chunter.actionImpl.UnarchiveChannel
|
||||||
|
},
|
||||||
|
chunter.action.UnarchiveChannel
|
||||||
|
)
|
||||||
|
|
||||||
|
builder.createDoc(view.class.ActionTarget, core.space.Model, {
|
||||||
|
target: chunter.class.Channel,
|
||||||
|
action: chunter.action.ArchiveChannel,
|
||||||
|
query: {
|
||||||
|
archived: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
builder.createDoc(view.class.ActionTarget, core.space.Model, {
|
||||||
|
target: chunter.class.Channel,
|
||||||
|
action: chunter.action.UnarchiveChannel,
|
||||||
|
query: {
|
||||||
|
archived: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
builder.createDoc(view.class.ActionTarget, core.space.Model, {
|
builder.createDoc(view.class.ActionTarget, core.space.Model, {
|
||||||
target: chunter.class.ThreadMessage,
|
target: chunter.class.ThreadMessage,
|
||||||
action: chunter.action.MarkCommentUnread
|
action: chunter.action.MarkCommentUnread
|
||||||
@ -172,6 +210,15 @@ export function createModel (builder: Builder): void {
|
|||||||
hidden: false,
|
hidden: false,
|
||||||
navigatorModel: {
|
navigatorModel: {
|
||||||
specials: [
|
specials: [
|
||||||
|
{
|
||||||
|
id: 'archive',
|
||||||
|
component: workbench.component.Archive,
|
||||||
|
icon: view.icon.Archive,
|
||||||
|
label: workbench.string.Archive,
|
||||||
|
position: 'top',
|
||||||
|
visibleIf: workbench.function.HasArchiveSpaces,
|
||||||
|
spaceClass: chunter.class.Channel
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'threads',
|
id: 'threads',
|
||||||
label: chunter.string.Threads,
|
label: chunter.string.Threads,
|
||||||
|
@ -31,11 +31,15 @@ export default mergeIds(chunterId, chunter, {
|
|||||||
},
|
},
|
||||||
action: {
|
action: {
|
||||||
MarkCommentUnread: '' as Ref<Action>,
|
MarkCommentUnread: '' as Ref<Action>,
|
||||||
MarkUnread: '' as Ref<Action>
|
MarkUnread: '' as Ref<Action>,
|
||||||
|
ArchiveChannel: '' as Ref<Action>,
|
||||||
|
UnarchiveChannel: '' as Ref<Action>
|
||||||
},
|
},
|
||||||
actionImpl: {
|
actionImpl: {
|
||||||
MarkUnread: '' as Resource<(object: Doc) => Promise<void>>,
|
MarkUnread: '' as Resource<(object: Doc) => Promise<void>>,
|
||||||
MarkCommentUnread: '' as Resource<(object: Doc) => Promise<void>>
|
MarkCommentUnread: '' as Resource<(object: Doc) => Promise<void>>,
|
||||||
|
ArchiveChannel: '' as Resource<(object: Doc) => Promise<void>>,
|
||||||
|
UnarchiveChannel: '' as Resource<(object: Doc) => Promise<void>>
|
||||||
},
|
},
|
||||||
string: {
|
string: {
|
||||||
ApplicationLabelChunter: '' as IntlString,
|
ApplicationLabelChunter: '' as IntlString,
|
||||||
|
@ -39,6 +39,11 @@
|
|||||||
"Edited": "edited",
|
"Edited": "edited",
|
||||||
"DeleteMessage": "Delete message",
|
"DeleteMessage": "Delete message",
|
||||||
"AndYou": "{participants, plural, =0 {Just you} other {and you}}",
|
"AndYou": "{participants, plural, =0 {Just you} other {and you}}",
|
||||||
"ShowMoreReplies": "Show {count} more replies"
|
"ShowMoreReplies": "Show {count} more replies",
|
||||||
|
"Settings": "Settings",
|
||||||
|
"ArchiveChannel": "Archive channel",
|
||||||
|
"UnarchiveChannel": "Unarchive channel",
|
||||||
|
"ArchiveConfirm": "Do you want to archive channel?",
|
||||||
|
"UnarchiveConfirm": "Do you want to unarchive channel?"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -38,6 +38,11 @@
|
|||||||
"Edited": "отредактировано",
|
"Edited": "отредактировано",
|
||||||
"DeleteMessage": "Удалить сообщение",
|
"DeleteMessage": "Удалить сообщение",
|
||||||
"AndYou": "{participants, plural, =0 {Только вы} other {и вы}}",
|
"AndYou": "{participants, plural, =0 {Только вы} other {и вы}}",
|
||||||
"ShowMoreReplies": "{count, plural, =3 {Показать еще # ответа} =4 {Показать еще # ответа} other {Показать еще # ответов}}"
|
"ShowMoreReplies": "{count, plural, =3 {Показать еще # ответа} =4 {Показать еще # ответа} other {Показать еще # ответов}}",
|
||||||
|
"Settings": "Настройки",
|
||||||
|
"ArchiveChannel": "Архивировать канал",
|
||||||
|
"UnarchiveChannel": "Разархивировать канал",
|
||||||
|
"ArchiveConfirm": "Вы действительно хотите архивировать канал?",
|
||||||
|
"UnarchiveConfirm": "Вы действительно хотите разархивировать канал?"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
import chunter from '../plugin'
|
import chunter from '../plugin'
|
||||||
import EditChannelDescriptionTab from './EditChannelDescriptionTab.svelte'
|
import EditChannelDescriptionTab from './EditChannelDescriptionTab.svelte'
|
||||||
|
import EditChannelSettingsTab from './EditChannelSettingsTab.svelte'
|
||||||
|
|
||||||
export let _id: Ref<Channel>
|
export let _id: Ref<Channel>
|
||||||
export let _class: Ref<Class<Channel>>
|
export let _class: Ref<Class<Channel>>
|
||||||
@ -39,7 +40,7 @@
|
|||||||
channel = result[0]
|
channel = result[0]
|
||||||
})
|
})
|
||||||
|
|
||||||
const tabLabels: IntlString[] = [chunter.string.Channel, chunter.string.Members]
|
const tabLabels: IntlString[] = [chunter.string.Channel, chunter.string.Members, chunter.string.Settings]
|
||||||
let selectedTabIndex = 0
|
let selectedTabIndex = 0
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -83,9 +84,11 @@
|
|||||||
<Scroller padding>
|
<Scroller padding>
|
||||||
{#if selectedTabIndex === 0}
|
{#if selectedTabIndex === 0}
|
||||||
<EditChannelDescriptionTab {channel} {_id} {_class} />
|
<EditChannelDescriptionTab {channel} {_id} {_class} />
|
||||||
{:else}
|
{:else if selectedTabIndex === 1}
|
||||||
<!-- Channel members -->
|
<!-- Channel members -->
|
||||||
<Members />
|
<Members />
|
||||||
|
{:else if selectedTabIndex === 2}
|
||||||
|
<EditChannelSettingsTab {channel} on:close />
|
||||||
{/if}
|
{/if}
|
||||||
</Scroller>
|
</Scroller>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { Channel } from '@anticrm/chunter'
|
||||||
|
import { Button } from '@anticrm/ui'
|
||||||
|
import { createEventDispatcher } from 'svelte';
|
||||||
|
import { ArchiveChannel } from '../index'
|
||||||
|
import chunter from '../plugin'
|
||||||
|
|
||||||
|
export let channel: Channel
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if channel}
|
||||||
|
<div class="flex-col flex-gap-3">
|
||||||
|
<Button
|
||||||
|
label={chunter.string.ArchiveChannel}
|
||||||
|
justify={'left'}
|
||||||
|
on:click={() => {
|
||||||
|
ArchiveChannel(channel, () => dispatch('close'))
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
@ -17,7 +17,8 @@ import core from '@anticrm/core'
|
|||||||
import chunter, { Channel, ChunterMessage, Message, ThreadMessage } from '@anticrm/chunter'
|
import chunter, { Channel, ChunterMessage, Message, ThreadMessage } from '@anticrm/chunter'
|
||||||
import { NotificationClientImpl } from '@anticrm/notification-resources'
|
import { NotificationClientImpl } from '@anticrm/notification-resources'
|
||||||
import { Resources } from '@anticrm/platform'
|
import { Resources } from '@anticrm/platform'
|
||||||
import { getClient } from '@anticrm/presentation'
|
import { getClient, MessageBox } from '@anticrm/presentation'
|
||||||
|
import { getCurrentLocation, navigate, showPopup } from '@anticrm/ui'
|
||||||
import TxBacklinkCreate from './components/activity/TxBacklinkCreate.svelte'
|
import TxBacklinkCreate from './components/activity/TxBacklinkCreate.svelte'
|
||||||
import TxBacklinkReference from './components/activity/TxBacklinkReference.svelte'
|
import TxBacklinkReference from './components/activity/TxBacklinkReference.svelte'
|
||||||
import TxCommentCreate from './components/activity/TxCommentCreate.svelte'
|
import TxCommentCreate from './components/activity/TxCommentCreate.svelte'
|
||||||
@ -80,6 +81,50 @@ export async function UnpinMessage (message: ChunterMessage): Promise<void> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function ArchiveChannel (channel: Channel, afterArchive?: () => void): Promise<void> {
|
||||||
|
showPopup(
|
||||||
|
MessageBox,
|
||||||
|
{
|
||||||
|
label: chunter.string.ArchiveChannel,
|
||||||
|
message: chunter.string.ArchiveConfirm
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
(result: boolean) => {
|
||||||
|
if (result) {
|
||||||
|
const client = getClient()
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
client.update(channel, { archived: true })
|
||||||
|
if (afterArchive != null) afterArchive()
|
||||||
|
|
||||||
|
const loc = getCurrentLocation()
|
||||||
|
if (loc.path[2] === channel._id) {
|
||||||
|
loc.path.length = 2
|
||||||
|
navigate(loc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function UnarchiveChannel (channel: Channel): Promise<void> {
|
||||||
|
showPopup(
|
||||||
|
MessageBox,
|
||||||
|
{
|
||||||
|
label: chunter.string.UnarchiveChannel,
|
||||||
|
message: chunter.string.UnarchiveConfirm
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
(result: boolean) => {
|
||||||
|
if (result) {
|
||||||
|
const client = getClient()
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
|
client.update(channel, { archived: false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
export default async (): Promise<Resources> => ({
|
export default async (): Promise<Resources> => ({
|
||||||
component: {
|
component: {
|
||||||
CommentInput,
|
CommentInput,
|
||||||
@ -104,6 +149,8 @@ export default async (): Promise<Resources> => ({
|
|||||||
SubscribeMessage,
|
SubscribeMessage,
|
||||||
UnsubscribeMessage,
|
UnsubscribeMessage,
|
||||||
PinMessage,
|
PinMessage,
|
||||||
UnpinMessage
|
UnpinMessage,
|
||||||
|
ArchiveChannel,
|
||||||
|
UnarchiveChannel
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -112,7 +112,12 @@ export default plugin(chunterId, {
|
|||||||
string: {
|
string: {
|
||||||
EditUpdate: '' as IntlString,
|
EditUpdate: '' as IntlString,
|
||||||
EditCancel: '' as IntlString,
|
EditCancel: '' as IntlString,
|
||||||
Comments: '' as IntlString
|
Comments: '' as IntlString,
|
||||||
|
Settings: '' as IntlString,
|
||||||
|
ArchiveChannel: '' as IntlString,
|
||||||
|
UnarchiveChannel: '' as IntlString,
|
||||||
|
ArchiveConfirm: '' as IntlString,
|
||||||
|
UnarchiveConfirm: '' as IntlString
|
||||||
},
|
},
|
||||||
app: {
|
app: {
|
||||||
Chunter: '' as Ref<Doc>
|
Chunter: '' as Ref<Doc>
|
||||||
|
Loading…
Reference in New Issue
Block a user