chore: remove unused imports

pull/892/head
Ryan Wang 2023-02-27 15:43:55 +08:00
parent 9198be086a
commit f3d5bf7a3f
2 changed files with 31 additions and 25 deletions

View File

@ -15,14 +15,9 @@ import {
} from "@halo-dev/components";
import CommentListItem from "./components/CommentListItem.vue";
import UserDropdownSelector from "@/components/dropdown-selector/UserDropdownSelector.vue";
import type {
ListedComment,
ListedCommentList,
User,
} from "@halo-dev/api-client";
import { computed, onMounted, ref, watch } from "vue";
import type { ListedComment, User } from "@halo-dev/api-client";
import { computed, ref, watch } from "vue";
import { apiClient } from "@/utils/api-client";
import { onBeforeRouteLeave } from "vue-router";
import FilterTag from "@/components/filter/FilterTag.vue";
import FilterCleanButton from "@/components/filter/FilterCleanButton.vue";
import { getNode } from "@formkit/core";
@ -247,15 +242,20 @@ const handleApproveInBatch = async () => {
) && !comment.comment.spec.approved
);
});
const promises = commentsToUpdate?.map((comment) => {
const commentToUpdate = comment.comment;
commentToUpdate.spec.approved = true;
// TODO: see https://github.com/halo-dev/halo/pull/2746
commentToUpdate.spec.approvedTime = new Date().toISOString();
return apiClient.extension.comment.updatecontentHaloRunV1alpha1Comment(
{
name: commentToUpdate.metadata.name,
comment: commentToUpdate,
name: comment.comment.metadata.name,
comment: {
...comment.comment,
spec: {
...comment.comment.spec,
approved: true,
// TODO: see https://github.com/halo-dev/halo/pull/2746
approvedTime: new Date().toISOString(),
},
},
}
);
});

View File

@ -84,13 +84,17 @@ const handleApproveReplyInBatch = async () => {
return !reply.reply.spec.approved;
});
const promises = repliesToUpdate?.map((reply) => {
const replyToUpdate = reply.reply;
replyToUpdate.spec.approved = true;
// TODO: see https://github.com/halo-dev/halo/pull/2746
replyToUpdate.spec.approvedTime = new Date().toISOString();
return apiClient.extension.reply.updatecontentHaloRunV1alpha1Reply({
name: replyToUpdate.metadata.name,
reply: replyToUpdate,
name: reply.reply.metadata.name,
reply: {
...reply.reply,
spec: {
...reply.reply.spec,
approved: true,
// TODO: see https://github.com/halo-dev/halo/pull/2746
approvedTime: new Date().toISOString(),
},
},
});
});
await Promise.all(promises || []);
@ -163,12 +167,14 @@ const handleToggleShowReplies = async () => {
showReplies.value = !showReplies.value;
if (showReplies.value) {
// update last read time
const commentToUpdate = cloneDeep(props.comment.comment);
commentToUpdate.spec.lastReadTime = new Date().toISOString();
await apiClient.extension.comment.updatecontentHaloRunV1alpha1Comment({
name: commentToUpdate.metadata.name,
comment: commentToUpdate,
});
if (props.comment.comment.status?.unreadReplyCount) {
const commentToUpdate = cloneDeep(props.comment.comment);
commentToUpdate.spec.lastReadTime = new Date().toISOString();
await apiClient.extension.comment.updatecontentHaloRunV1alpha1Comment({
name: commentToUpdate.metadata.name,
comment: commentToUpdate,
});
}
} else {
emit("reload");
}