mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-02 22:13:38 +00:00
27 lines
742 B
TypeScript
27 lines
742 B
TypeScript
//
|
|
// Copyright © 2023 Hardcore Engineering Inc.
|
|
//
|
|
|
|
import type { Question } from '@hcengineering/questions'
|
|
import { getClient } from '@hcengineering/presentation'
|
|
import { canUpdateQuestion } from '../utils'
|
|
import { eachItemActionWithAvailability } from './ActionWithAvailability'
|
|
|
|
export const questionDeleteAction = eachItemActionWithAvailability<Question<unknown>>(
|
|
async (object: Question<unknown>) => {
|
|
return canUpdateQuestion(object)
|
|
},
|
|
async (object: Question<unknown>) => {
|
|
// TODO: Do we need a confirmation popup?
|
|
await getClient().removeCollection(
|
|
object._class,
|
|
object.space,
|
|
object._id,
|
|
object.attachedTo,
|
|
object.attachedToClass,
|
|
object.collection
|
|
)
|
|
},
|
|
true
|
|
)
|