mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 12:55:59 +00:00
Chunter: Remove attachments only for creator (#1552)
Signed-off-by: Denis Bunakalya <denis.bunakalya@xored.com>
This commit is contained in:
parent
d64c009366
commit
260d8d95fd
@ -43,6 +43,7 @@
|
|||||||
"FileBrowserTypeFilterVideos": "Videos",
|
"FileBrowserTypeFilterVideos": "Videos",
|
||||||
"FileBrowserTypeFilterPDFs": "PDFs",
|
"FileBrowserTypeFilterPDFs": "PDFs",
|
||||||
"AddAttachmentToSaved": "Add attachment to saved",
|
"AddAttachmentToSaved": "Add attachment to saved",
|
||||||
"RemoveAttachmentFromSaved": "Remove attachment from saved"
|
"RemoveAttachmentFromSaved": "Remove attachment from saved",
|
||||||
|
"DeleteFile": "Delete file"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
"FileBrowserTypeFilterVideos": "Видео",
|
"FileBrowserTypeFilterVideos": "Видео",
|
||||||
"FileBrowserTypeFilterPDFs": "PDF-файлы",
|
"FileBrowserTypeFilterPDFs": "PDF-файлы",
|
||||||
"AddAttachmentToSaved": "Добавить вложение в сохраненные",
|
"AddAttachmentToSaved": "Добавить вложение в сохраненные",
|
||||||
"RemoveAttachmentFromSaved": "Удалить вложение из сохраненных"
|
"RemoveAttachmentFromSaved": "Удалить вложение из сохраненных",
|
||||||
|
"DeleteFile": "Удалить файл"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,22 +13,39 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Attachment } from '@anticrm/attachment'
|
import attachment, { Attachment } from '@anticrm/attachment'
|
||||||
import { Doc } from '@anticrm/core'
|
import { Doc, getCurrentAccount } from '@anticrm/core'
|
||||||
import { getFileUrl } from '@anticrm/presentation'
|
import { getFileUrl, getClient } from '@anticrm/presentation'
|
||||||
import { Icon, IconMoreV, showPopup } from '@anticrm/ui'
|
import { Icon, IconMoreV, showPopup, Menu } from '@anticrm/ui'
|
||||||
import { Menu } from '@anticrm/view-resources'
|
|
||||||
import FileDownload from './icons/FileDownload.svelte'
|
import FileDownload from './icons/FileDownload.svelte'
|
||||||
import { AttachmentGalleryPresenter } from '..'
|
import { AttachmentGalleryPresenter } from '..'
|
||||||
|
|
||||||
export let attachments: Attachment[]
|
export let attachments: Attachment[]
|
||||||
let selectedFileNumber: number | undefined
|
let selectedFileNumber: number | undefined
|
||||||
|
const myAccId = getCurrentAccount()._id
|
||||||
|
const client = getClient()
|
||||||
|
|
||||||
const showFileMenu = async (ev: MouseEvent, object: Doc, fileNumber: number): Promise<void> => {
|
const showFileMenu = async (ev: MouseEvent, object: Doc, fileNumber: number): Promise<void> => {
|
||||||
selectedFileNumber = fileNumber
|
selectedFileNumber = fileNumber
|
||||||
showPopup(Menu, { object }, ev.target as HTMLElement, () => {
|
showPopup(
|
||||||
selectedFileNumber = undefined
|
Menu,
|
||||||
})
|
{
|
||||||
|
actions: [
|
||||||
|
...(myAccId === object.modifiedBy
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
label: attachment.string.DeleteFile,
|
||||||
|
action: async () => await client.removeDoc(object._class, object.space, object._id)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
: [])
|
||||||
|
]
|
||||||
|
},
|
||||||
|
ev.target as HTMLElement,
|
||||||
|
() => {
|
||||||
|
selectedFileNumber = undefined
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -13,22 +13,39 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Attachment } from '@anticrm/attachment'
|
import attachment, { Attachment } from '@anticrm/attachment'
|
||||||
import { Doc } from '@anticrm/core'
|
import { Doc, getCurrentAccount } from '@anticrm/core'
|
||||||
import { getFileUrl } from '@anticrm/presentation'
|
import { getFileUrl, getClient } from '@anticrm/presentation'
|
||||||
import { Icon, IconMoreV, showPopup } from '@anticrm/ui'
|
import { Icon, IconMoreV, showPopup, Menu } from '@anticrm/ui'
|
||||||
import { Menu } from '@anticrm/view-resources'
|
|
||||||
import FileDownload from './icons/FileDownload.svelte'
|
import FileDownload from './icons/FileDownload.svelte'
|
||||||
import { AttachmentPresenter } from '..'
|
import { AttachmentPresenter } from '..'
|
||||||
|
|
||||||
export let attachments: Attachment[]
|
export let attachments: Attachment[]
|
||||||
let selectedFileNumber: number | undefined
|
let selectedFileNumber: number | undefined
|
||||||
|
const myAccId = getCurrentAccount()._id
|
||||||
|
const client = getClient()
|
||||||
|
|
||||||
const showFileMenu = async (ev: MouseEvent, object: Doc, fileNumber: number): Promise<void> => {
|
const showFileMenu = async (ev: MouseEvent, object: Doc, fileNumber: number): Promise<void> => {
|
||||||
selectedFileNumber = fileNumber
|
selectedFileNumber = fileNumber
|
||||||
showPopup(Menu, { object }, ev.target as HTMLElement, () => {
|
showPopup(
|
||||||
selectedFileNumber = undefined
|
Menu,
|
||||||
})
|
{
|
||||||
|
actions: [
|
||||||
|
...(myAccId === object.modifiedBy
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
label: attachment.string.DeleteFile,
|
||||||
|
action: async () => await client.removeDoc(object._class, object.space, object._id)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
: [])
|
||||||
|
]
|
||||||
|
},
|
||||||
|
ev.target as HTMLElement,
|
||||||
|
() => {
|
||||||
|
selectedFileNumber = undefined
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ export default plugin(attachmentId, {
|
|||||||
FileBrowserTypeFilterImages: '' as IntlString,
|
FileBrowserTypeFilterImages: '' as IntlString,
|
||||||
FileBrowserTypeFilterAudio: '' as IntlString,
|
FileBrowserTypeFilterAudio: '' as IntlString,
|
||||||
FileBrowserTypeFilterVideos: '' as IntlString,
|
FileBrowserTypeFilterVideos: '' as IntlString,
|
||||||
FileBrowserTypeFilterPDFs: '' as IntlString
|
FileBrowserTypeFilterPDFs: '' as IntlString,
|
||||||
|
DeleteFile: '' as IntlString
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -17,12 +17,13 @@
|
|||||||
import attachment, { Attachment } from '@anticrm/attachment'
|
import attachment, { Attachment } from '@anticrm/attachment'
|
||||||
import { AttachmentPresenter, FileDownload } from '@anticrm/attachment-resources'
|
import { AttachmentPresenter, FileDownload } from '@anticrm/attachment-resources'
|
||||||
import { ChunterSpace } from '@anticrm/chunter'
|
import { ChunterSpace } from '@anticrm/chunter'
|
||||||
import { Doc, SortingOrder } from '@anticrm/core'
|
import { Doc, SortingOrder, getCurrentAccount } from '@anticrm/core'
|
||||||
import { createQuery, getFileUrl } from '@anticrm/presentation'
|
import { createQuery, getFileUrl, getClient } from '@anticrm/presentation'
|
||||||
import { Menu } from '@anticrm/view-resources'
|
import { getCurrentLocation, showPopup, IconMoreV, Label, navigate, Icon, Menu } from '@anticrm/ui'
|
||||||
import { getCurrentLocation, showPopup, IconMoreV, Label, navigate, Icon } from '@anticrm/ui'
|
|
||||||
|
|
||||||
export let channel: ChunterSpace | undefined
|
export let channel: ChunterSpace | undefined
|
||||||
|
const myAccId = getCurrentAccount()._id
|
||||||
|
const client = getClient()
|
||||||
|
|
||||||
const query = createQuery()
|
const query = createQuery()
|
||||||
let visibleAttachments: Attachment[] | undefined
|
let visibleAttachments: Attachment[] | undefined
|
||||||
@ -33,9 +34,25 @@
|
|||||||
|
|
||||||
const showMenu = async (ev: MouseEvent, object: Doc, rowNumber: number): Promise<void> => {
|
const showMenu = async (ev: MouseEvent, object: Doc, rowNumber: number): Promise<void> => {
|
||||||
selectedRowNumber = rowNumber
|
selectedRowNumber = rowNumber
|
||||||
showPopup(Menu, { object }, ev.target as HTMLElement, () => {
|
showPopup(
|
||||||
selectedRowNumber = undefined
|
Menu,
|
||||||
})
|
{
|
||||||
|
actions: [
|
||||||
|
...(myAccId === object.modifiedBy
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
label: attachment.string.DeleteFile,
|
||||||
|
action: async () => await client.removeDoc(object._class, object.space, object._id)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
: [])
|
||||||
|
]
|
||||||
|
},
|
||||||
|
ev.target as HTMLElement,
|
||||||
|
() => {
|
||||||
|
selectedRowNumber = undefined
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
$: channel &&
|
$: channel &&
|
||||||
|
Loading…
Reference in New Issue
Block a user