Skip to content

Commit

Permalink
fix: リリースしているトピックを削除しない
Browse files Browse the repository at this point in the history
  • Loading branch information
acutus-fujii committed Jan 7, 2025
1 parent bee2efa commit 3b56e12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 1 addition & 3 deletions components/templates/Topics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ export default function Topics(props: Props) {
const enableBookNewButton = true;
const enableShareButton = false;
const enableDeleteButton =
isAdministrator ||
searchProps.query.filter === "edit" ||
searchProps.query.filter === "release";
isAdministrator || searchProps.query.filter === "edit";

return (
<Container twoColumns maxWidth="xl">
Expand Down
6 changes: 5 additions & 1 deletion pages/topics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import useTopics from "$utils/useTopics";
import { destroyTopic, updateTopic } from "$utils/topic";
import { useSearchAtom } from "$store/search";
import { revalidateContents } from "$utils/useContents";
import { getReleaseFromRelatedBooks } from "$utils/release";

const Topics = (
props: Omit<
Expand Down Expand Up @@ -41,7 +42,10 @@ function Index() {
}
async function handleTopicsDeleteClick(topics: TopicSchema[]) {
for (const topic of topics) {
if (isContentEditable(topic)) {
if (
isContentEditable(topic) &&
!getReleaseFromRelatedBooks(topic.relatedBooks)
) {
await destroyTopic(topic.id);
}
}
Expand Down

0 comments on commit 3b56e12

Please sign in to comment.