mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 03:14:40 +03: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",
|
||||
"FileBrowserTypeFilterPDFs": "PDFs",
|
||||
"AddAttachmentToSaved": "Add attachment to saved",
|
||||
"RemoveAttachmentFromSaved": "Remove attachment from saved"
|
||||
"RemoveAttachmentFromSaved": "Remove attachment from saved",
|
||||
"DeleteFile": "Delete file"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@
|
||||
"FileBrowserTypeFilterVideos": "Видео",
|
||||
"FileBrowserTypeFilterPDFs": "PDF-файлы",
|
||||
"AddAttachmentToSaved": "Добавить вложение в сохраненные",
|
||||
"RemoveAttachmentFromSaved": "Удалить вложение из сохраненных"
|
||||
"RemoveAttachmentFromSaved": "Удалить вложение из сохраненных",
|
||||
"DeleteFile": "Удалить файл"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,22 +13,39 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Attachment } from '@anticrm/attachment'
|
||||
import { Doc } from '@anticrm/core'
|
||||
import { getFileUrl } from '@anticrm/presentation'
|
||||
import { Icon, IconMoreV, showPopup } from '@anticrm/ui'
|
||||
import { Menu } from '@anticrm/view-resources'
|
||||
import attachment, { Attachment } from '@anticrm/attachment'
|
||||
import { Doc, getCurrentAccount } from '@anticrm/core'
|
||||
import { getFileUrl, getClient } from '@anticrm/presentation'
|
||||
import { Icon, IconMoreV, showPopup, Menu } from '@anticrm/ui'
|
||||
import FileDownload from './icons/FileDownload.svelte'
|
||||
import { AttachmentGalleryPresenter } from '..'
|
||||
|
||||
export let attachments: Attachment[]
|
||||
let selectedFileNumber: number | undefined
|
||||
const myAccId = getCurrentAccount()._id
|
||||
const client = getClient()
|
||||
|
||||
const showFileMenu = async (ev: MouseEvent, object: Doc, fileNumber: number): Promise<void> => {
|
||||
selectedFileNumber = fileNumber
|
||||
showPopup(Menu, { object }, ev.target as HTMLElement, () => {
|
||||
selectedFileNumber = undefined
|
||||
})
|
||||
showPopup(
|
||||
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>
|
||||
|
||||
|
@ -13,22 +13,39 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Attachment } from '@anticrm/attachment'
|
||||
import { Doc } from '@anticrm/core'
|
||||
import { getFileUrl } from '@anticrm/presentation'
|
||||
import { Icon, IconMoreV, showPopup } from '@anticrm/ui'
|
||||
import { Menu } from '@anticrm/view-resources'
|
||||
import attachment, { Attachment } from '@anticrm/attachment'
|
||||
import { Doc, getCurrentAccount } from '@anticrm/core'
|
||||
import { getFileUrl, getClient } from '@anticrm/presentation'
|
||||
import { Icon, IconMoreV, showPopup, Menu } from '@anticrm/ui'
|
||||
import FileDownload from './icons/FileDownload.svelte'
|
||||
import { AttachmentPresenter } from '..'
|
||||
|
||||
export let attachments: Attachment[]
|
||||
let selectedFileNumber: number | undefined
|
||||
const myAccId = getCurrentAccount()._id
|
||||
const client = getClient()
|
||||
|
||||
const showFileMenu = async (ev: MouseEvent, object: Doc, fileNumber: number): Promise<void> => {
|
||||
selectedFileNumber = fileNumber
|
||||
showPopup(Menu, { object }, ev.target as HTMLElement, () => {
|
||||
selectedFileNumber = undefined
|
||||
})
|
||||
showPopup(
|
||||
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>
|
||||
|
||||
|
@ -83,6 +83,7 @@ export default plugin(attachmentId, {
|
||||
FileBrowserTypeFilterImages: '' as IntlString,
|
||||
FileBrowserTypeFilterAudio: '' 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 { AttachmentPresenter, FileDownload } from '@anticrm/attachment-resources'
|
||||
import { ChunterSpace } from '@anticrm/chunter'
|
||||
import { Doc, SortingOrder } from '@anticrm/core'
|
||||
import { createQuery, getFileUrl } from '@anticrm/presentation'
|
||||
import { Menu } from '@anticrm/view-resources'
|
||||
import { getCurrentLocation, showPopup, IconMoreV, Label, navigate, Icon } from '@anticrm/ui'
|
||||
import { Doc, SortingOrder, getCurrentAccount } from '@anticrm/core'
|
||||
import { createQuery, getFileUrl, getClient } from '@anticrm/presentation'
|
||||
import { getCurrentLocation, showPopup, IconMoreV, Label, navigate, Icon, Menu } from '@anticrm/ui'
|
||||
|
||||
export let channel: ChunterSpace | undefined
|
||||
const myAccId = getCurrentAccount()._id
|
||||
const client = getClient()
|
||||
|
||||
const query = createQuery()
|
||||
let visibleAttachments: Attachment[] | undefined
|
||||
@ -33,9 +34,25 @@
|
||||
|
||||
const showMenu = async (ev: MouseEvent, object: Doc, rowNumber: number): Promise<void> => {
|
||||
selectedRowNumber = rowNumber
|
||||
showPopup(Menu, { object }, ev.target as HTMLElement, () => {
|
||||
selectedRowNumber = undefined
|
||||
})
|
||||
showPopup(
|
||||
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 &&
|
||||
|
Loading…
Reference in New Issue
Block a user