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

feat: make comment subject ref provider extensible #4039

Merged
merged 8 commits into from Jun 26, 2023

Conversation

ruibaby
Copy link
Member

@ruibaby ruibaby commented Jun 5, 2023

What type of PR is this?

/area console
/kind feature

What this PR does / why we need it:

让评论来源的显示支持通过插件扩展,目前如 瞬间 这类的插件如果使用了评论模块,那么在评论管理是无法显示具体来源的:

image

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

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?

Console 端的评论来源显示支持通过插件扩展。

Signed-off-by: Ryan Wang <i@ryanc.cc>
@f2c-ci-robot f2c-ci-robot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. area/console Issues or PRs related to the Halo Console kind/feature Categorizes issue or PR as related to a new feature. labels Jun 5, 2023
@f2c-ci-robot f2c-ci-robot bot requested review from JohnNiang and wzrove June 5, 2023 09:42
@codecov
Copy link

codecov bot commented Jun 5, 2023

Codecov Report

Merging #4039 (ab4ba0d) into main (96225e4) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main    #4039   +/-   ##
=========================================
  Coverage     60.34%   60.34%           
  Complexity     2392     2392           
=========================================
  Files           359      359           
  Lines         12393    12393           
  Branches        892      892           
=========================================
  Hits           7478     7478           
  Misses         4478     4478           
  Partials        437      437           

@guqing
Copy link
Member

guqing commented Jun 5, 2023

@ruibaby
image
评论这里可能得处理一下,有几个问题:

  1. 内容会超出容器
  2. 对于没有标题的需要显示内容,而moment可能没有内容只有图片,所以这里是否需要支持 html 预览显示

@ruibaby
Copy link
Member Author

ruibaby commented Jun 5, 2023

@guqing 因为无法验证,所以暂时取了 content 作为标题,像 moment 这种没有标题属性的可能用内容也不行,会有很多内容。

可以考虑用时间作为标题,或者取内容的前一部分。

@guqing
Copy link
Member

guqing commented Jun 5, 2023

@guqing 因为无法验证,所以暂时取了 content 作为标题,像 moment 这种没有标题属性的可能用内容也不行,会有很多内容。

可以考虑用时间作为标题,或者取内容的前一部分。

如果太长 console 评论列表可以不显示这么多字只显示到可视范围,或者 moment 处理一下截取部分

Signed-off-by: Ryan Wang <i@ryanc.cc>
@ruibaby ruibaby added this to the 2.7.x milestone Jun 6, 2023
@ruibaby ruibaby added the area/plugin Issues or PRs related to the Plugin Provider label Jun 7, 2023
@ruibaby ruibaby changed the title WIP: feat: make comment subject ref provider extensible feat: make comment subject ref provider extensible Jun 9, 2023
@f2c-ci-robot f2c-ci-robot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 9, 2023
@JohnNiang
Copy link
Member

@ruibaby image 评论这里可能得处理一下,有几个问题:

  1. 内容会超出容器
  2. 对于没有标题的需要显示内容,而moment可能没有内容只有图片,所以这里是否需要支持 html 预览显示

Hi @guqing ,个人觉得这个问题和当前 PR 没有直接关系,建议重新提 Issue 来解决。

Copy link
Member

@guqing guqing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jun 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guqing

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 13, 2023
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

当前的扩展点是否需要在文档中描述一下呢?

Signed-off-by: Ryan Wang <i@ryanc.cc>
@ruibaby
Copy link
Member Author

ruibaby commented Jun 14, 2023

当前的扩展点是否需要在文档中描述一下呢?

已补充。

@ruibaby
Copy link
Member Author

ruibaby commented Jun 19, 2023

cc @halo-dev/sig-halo-console

@LIlGG
Copy link
Member

LIlGG commented Jun 26, 2023

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Jun 26, 2023
@f2c-ci-robot f2c-ci-robot bot merged commit 8c05a6d into halo-dev:main Jun 26, 2023
4 checks passed
@ruibaby ruibaby deleted the feat/comment-subject-ref-extend branch June 26, 2023 04:24
@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
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/console Issues or PRs related to the Halo Console area/plugin Issues or PRs related to the Plugin Provider kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Console 端评论功能增加评论来源的扩展点
4 participants