Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console 端评论功能增加评论来源的扩展点 #3554

Closed
LIlGG opened this issue Mar 22, 2023 · 3 comments · Fixed by #4039
Closed

Console 端评论功能增加评论来源的扩展点 #3554

LIlGG opened this issue Mar 22, 2023 · 3 comments · Fixed by #4039
Assignees
Labels
area/console Issues or PRs related to the Halo Console kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@LIlGG
Copy link
Member

LIlGG commented Mar 22, 2023

你当前使用的版本

No response

描述一下此特性

Console 端评论组件会展示评论来源功能点,如下所示

image

而对来源于插件功能的评论,应当予以支持,例如瞬间,相册等,其他情况可以处理为“未知来源“

/kind feature
/area console

附加信息

No response

@f2c-ci-robot f2c-ci-robot bot added kind/feature Categorizes issue or PR as related to a new feature. area/console Issues or PRs related to the Halo Console labels Mar 22, 2023
@ruibaby
Copy link
Member

ruibaby commented Mar 22, 2023

/milestone 2.4.x

@f2c-ci-robot f2c-ci-robot bot added this to the 2.4.x milestone Mar 22, 2023
@ruibaby
Copy link
Member

ruibaby commented Mar 22, 2023

/assign

@ruibaby ruibaby modified the milestones: 2.4.x, 2.4.0, Backlog Mar 29, 2023
@ruibaby
Copy link
Member

ruibaby commented Jun 5, 2023

/milestone 2.7.x
/assign

@f2c-ci-robot f2c-ci-robot bot modified the milestones: Backlog, 2.7.x Jun 5, 2023
f2c-ci-robot bot pushed a commit that referenced this issue Jun 26, 2023
#### What type of PR is this?

/area console
/kind feature

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

让评论来源的显示支持通过插件扩展,目前如 [瞬间](https://github.com/halo-sigs/plugin-moments) 这类的插件如果使用了评论模块,那么在评论管理是无法显示具体来源的:

<img width="627" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/0df354dc-ed42-4217-abbd-5bce67329e0d">

此 PR 为 Console 端提供了拓展方法,使用方式如下:

```ts
import { definePlugin } from "@halo-dev/console-shared";
import type { CommentSubjectRefResult } from "@halo-dev/console-shared";
import type { Extension } from "@halo-dev/api-client";
import type { Moment } from "./types";

export default definePlugin({
  components: {},
  extensionPoints: {
    "comment:subject-ref:create": () => {
      return [
        {
          kind: "Moment",
          group: "moment.halo.run",
          resolve: (subject: Extension): CommentSubjectRefResult => {
            const moment = subject as Moment;
            return {
              label: "瞬间",
              title: determineMomentTitle(moment),
              externalUrl: `/moments/${moment.metadata.name}`,
              route: {
                name: "Moments",
              },
            };
          },
        },
      ];
    },
  },
});

```

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

Fixes #3554 

#### Special notes for your reviewer:

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

```release-note
Console 端的评论来源显示支持通过插件扩展
```
@ruibaby ruibaby modified the milestones: 2.7.x, 2.7.0 Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/console Issues or PRs related to the Halo Console kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants