Skip to content

Commit

Permalink
refactor: add creation time field for comments and replies (#14)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/kind improvement

#### What this PR does / why we need it:

增加迁移时评论和回复的创建时间字段。适配:halo-dev/halo#3341

#### Which issue(s) this PR fixes:

Fixes halo-dev/halo#3330

#### Special notes for your reviewer:

None

#### Does this PR introduce a user-facing change?

```release-note
None
```
  • Loading branch information
LIlGG authored Mar 30, 2023
1 parent 0710a01 commit ed1497a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
"@halo-dev/api-client": "^0.0.66",
"@halo-dev/api-client": "^2.3.0",
"@halo-dev/components": "^0.0.0-alpha.8",
"@halo-dev/console-shared": "^2.0.0-rc.1",
"@vueuse/core": "^9.6.0",
Expand Down
8 changes: 4 additions & 4 deletions console/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions console/src/composables/use-migrate-from-halo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ class PostTask implements MigrateRequestTask<Post> {
pinned: this.item.topPriority > 0,
allowComment: !this.item.disallowComment,
visible: "PUBLIC",
version: 1,
priority: 0,
excerpt: {
autoGenerate: false,
Expand Down Expand Up @@ -189,7 +188,6 @@ class SinglePageTask implements MigrateRequestTask<Sheet> {
pinned: this.item.topPriority > 0,
allowComment: !this.item.disallowComment,
visible: "PUBLIC",
version: 1,
priority: 0,
excerpt: {
autoGenerate: false,
Expand Down Expand Up @@ -273,6 +271,7 @@ class CreateCommentTask implements CommentTask {
allowNotification: this.item.allowNotification,
approved: this.item.status === "PUBLISHED",
approvedTime: new Date(this.item.createTime).toISOString(),
creationTime: new Date(this.item.createTime).toISOString(),
hidden: false,
subjectRef: {
...this.subjectRef,
Expand Down Expand Up @@ -323,6 +322,7 @@ class replyCreateComment implements CommentTask {
allowNotification: this.item.allowNotification,
approved: this.item.status === "PUBLISHED",
approvedTime: new Date(this.item.createTime).toISOString(),
creationTime: new Date(this.item.createTime).toISOString(),
hidden: false,
commentName: this.commentName + "",
quoteReply: this.item.parentId + "",
Expand Down
2 changes: 0 additions & 2 deletions console/src/utils/api-client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ApiConsoleHaloRunV1alpha1ContentApi,
ApiConsoleHaloRunV1alpha1PostApi,
ApiConsoleHaloRunV1alpha1SinglePageApi,
ApiConsoleHaloRunV1alpha1UserApi,
Expand Down Expand Up @@ -93,7 +92,6 @@ function setupApiClient(axios: AxiosInstance) {
baseURL,
axios
),
content: new ApiConsoleHaloRunV1alpha1ContentApi(undefined, baseURL, axios),
comment: new ApiConsoleHaloRunV1alpha1CommentApi(undefined, baseURL, axios),
reply: new ApiConsoleHaloRunV1alpha1ReplyApi(undefined, baseURL, axios),
stats: new ApiConsoleHaloRunV1alpha1StatsApi(undefined, baseURL, axios),
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/console/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
spec:
enabled: true
version: 1.1.0
requires: "*"
requires: ">=2.3.0"
author:
name: Halo OSS Team
website: https://github.com/halo-dev
Expand Down

0 comments on commit ed1497a

Please sign in to comment.