mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 17:25:16 -04:00

This adds support for keeping the uploads attached to a note when deleting the same note. This is done by a simple checkbox that can be clicked in the DeletionModal. To do this, some parts of the note deletion had to be refactored, especially in the case of the history page. Both the note deletion and history removal methods used the same modal, which isn't applicable now anymore. Additionally, there was a bug that the modal checked for ownership in the frontend before allowing the note deletion. However, in the context of the history page, the ownership couldn't be evaluated since the backend API didn't include that information. This is now fixed as well. Signed-off-by: Erik Michelson <github@erik.michelson.eu>
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
import type { HistoryEntry } from '../../../../api/history/types'
|
|
import { HttpMethod, respondToMatchingRequest } from '../../../../handler-utils/respond-to-matching-request'
|
|
import type { NextApiRequest, NextApiResponse } from 'next'
|
|
|
|
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
|
respondToMatchingRequest<HistoryEntry[]>(HttpMethod.GET, req, res, [
|
|
{
|
|
identifier: 'slide-example',
|
|
title: 'Slide example',
|
|
lastVisitedAt: '2020-05-30T15:20:36.088Z',
|
|
pinStatus: true,
|
|
tags: ['features', 'cool', 'updated'],
|
|
owner: null
|
|
},
|
|
{
|
|
identifier: 'features',
|
|
title: 'Features',
|
|
lastVisitedAt: '2020-05-31T15:20:36.088Z',
|
|
pinStatus: true,
|
|
tags: ['features', 'cool', 'updated'],
|
|
owner: null
|
|
},
|
|
{
|
|
identifier: 'ODakLc2MQkyyFc_Xmb53sg',
|
|
title: 'Non existent',
|
|
lastVisitedAt: '2020-05-25T19:48:14.025Z',
|
|
pinStatus: false,
|
|
tags: [],
|
|
owner: null
|
|
},
|
|
{
|
|
identifier: 'l8JuWxApTR6Fqa0LCrpnLg',
|
|
title: 'Non existent',
|
|
lastVisitedAt: '2020-05-24T16:04:36.433Z',
|
|
pinStatus: false,
|
|
tags: ['agenda', 'HedgeDoc community', 'community call'],
|
|
owner: 'test'
|
|
}
|
|
])
|
|
}
|
|
|
|
export default handler
|