Skip to content

feat(event): 更新消息表情点赞通知事件结构#397

Open
TinyTsuki wants to merge 2 commits into
MisakaTAT:mainfrom
TinyTsuki:dev/26.05.19
Open

feat(event): 更新消息表情点赞通知事件结构#397
TinyTsuki wants to merge 2 commits into
MisakaTAT:mainfrom
TinyTsuki:dev/26.05.19

Conversation

@TinyTsuki
Copy link
Copy Markdown
Contributor

@TinyTsuki TinyTsuki commented May 19, 2026

Summary by Sourcery

更新消息表情点赞通知事件结构,以与最新的通知负载字段保持一致。

增强内容:

  • 将操作者标识符的 JSON 字段重命名为在表情点赞通知事件中使用更新后的 user_id 键。
  • 为消息表情点赞通知事件扩展一个标志位,用于指示该表情反应是否为新增。
Original summary in English

Summary by Sourcery

Update the message emoji like notice event structure to align with the latest notification payload fields.

Enhancements:

  • Rename the operator identifier JSON field to use the updated user_id key in the emoji like notice event.
  • Extend the message emoji like notice event with a flag indicating whether the emoji reaction was added.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 19, 2026

审查者指南(在小型 PR 上折叠显示)

审查者指南

调整消息表情符号点赞通知事件负载,使其与更新后的 API 字段名保持一致,并新增一个标志,用于指示该事件对应的是添加还是移除表情反应。

文件级更改

Change Details Files
将通知事件字段映射与更新后的 JSON 模式对齐,并暴露一个新的添加/移除标志。
  • 将操作者标识符的 JSON 属性名从 operator_id 修改为 user_id,同时保持 Java 字段名 operatorId 不变,以反映上游 API 的变更。
  • 新增一个布尔字段 isAdd,映射到 JSON 属性 is_add,用于指示该表情点赞是被添加还是被移除。
src/main/java/com/mikuac/shiro/dto/event/notice/MessageEmojiLikeNoticeEvent.java

技巧与命令

与 Sourcery 交互

  • 触发新审查: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 通过回复某条审查评论来让 Sourcery 从该评论创建一个 issue。你也可以回复审查评论 @sourcery-ai issue 来从该评论创建一个 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文任意位置写上 @sourcery-ai summary,即可在你想要的位置生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审查者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可一次性解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,这会很有用。
  • 忽略所有 Sourcery 审查: 在 pull request 中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。特别适用于你想从一个全新的审查开始——别忘了再评论 @sourcery-ai review 来触发新的审查!

自定义你的使用体验

访问你的 dashboard 以:

  • 启用或停用审查功能,例如 Sourcery 生成的 pull request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the message emoji like notice event payload to match updated API field names and adds a new flag indicating whether the event corresponds to adding or removing a reaction.

File-Level Changes

Change Details Files
Align notice event field mappings with updated JSON schema and expose a new add/remove flag.
  • Change JSON property name for the operator identifier from operator_id to user_id while keeping the Java field name operatorId unchanged to reflect upstream API changes.
  • Introduce a new Boolean field isAdd mapped to JSON property is_add to indicate whether the emoji like was added or removed.
src/main/java/com/mikuac/shiro/dto/event/notice/MessageEmojiLikeNoticeEvent.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - 我发现了 1 个问题,并给出了一些总体反馈:

  • 现在 operatorId 字段映射自 user_id;请考虑重命名该字段(或添加一个已弃用的别名),以保持 Java 字段名与 JSON 语义一致,避免调用方产生混淆。
  • 对于 isAdd,请先确定是否真的需要三态;如果不需要,改用基础类型 boolean 而不是 Boolean 将简化处理逻辑,并避免在调用处出现意外的 null。
供 AI Agent 使用的提示词
Please address the comments from this code review:

## Overall Comments
- The `operatorId` field is now mapped from `user_id`; consider renaming the field (or adding a deprecated alias) to keep the Java name consistent with the JSON semantics and avoid confusion for callers.
- For `isAdd`, decide whether a tri-state is really needed; if not, using a primitive `boolean` instead of `Boolean` will simplify handling and avoid unexpected nulls at call sites.

## Individual Comments

### Comment 1
<location path="src/main/java/com/mikuac/shiro/dto/event/notice/MessageEmojiLikeNoticeEvent.java" line_range="34-35" />
<code_context>
      * 操作者ID
      */
-    @JsonProperty("operator_id")
+    @JsonProperty("user_id")
     private Long operatorId;

     /**
</code_context>
<issue_to_address>
**suggestion:** Field name `operatorId` no longer matches the JSON property `user_id`, which can be confusing.

Since the wire format is now `user_id` but the field name remains `operatorId`, please either rename the field to match (e.g. `userId`) or confirm that the payload should still use an operator-specific name and adjust the JSON property accordingly.

Suggested implementation:

```java
    /**
     * 操作者ID
     */
    @JsonProperty("user_id")
    private Long userId;

    /**
     * 点赞列表
     */
    @JsonProperty("likes")
    private List<Like> likes;

```

The field rename from `operatorId` to `userId` will also require:
1. Updating any getters/setters (e.g. `getOperatorId`/`setOperatorId`) in this class to `getUserId`/`setUserId`.
2. Updating all references to `operatorId`, `getOperatorId()`, and `setOperatorId(...)` across the codebase (including builders, mappers, tests, and serialization/deserialization logic) to use `userId`, `getUserId()`, and `setUserId(...)` respectively.
3. If Lombok is used (e.g. `@Data`, `@Getter`, `@Setter`), ensure there are no explicit methods or annotations still tied to `operatorId`.
</issue_to_address>

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
请帮我变得更有用!你可以对每条评论点 👍 或 👎,我会根据你的反馈改进之后的评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • The operatorId field is now mapped from user_id; consider renaming the field (or adding a deprecated alias) to keep the Java name consistent with the JSON semantics and avoid confusion for callers.
  • For isAdd, decide whether a tri-state is really needed; if not, using a primitive boolean instead of Boolean will simplify handling and avoid unexpected nulls at call sites.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `operatorId` field is now mapped from `user_id`; consider renaming the field (or adding a deprecated alias) to keep the Java name consistent with the JSON semantics and avoid confusion for callers.
- For `isAdd`, decide whether a tri-state is really needed; if not, using a primitive `boolean` instead of `Boolean` will simplify handling and avoid unexpected nulls at call sites.

## Individual Comments

### Comment 1
<location path="src/main/java/com/mikuac/shiro/dto/event/notice/MessageEmojiLikeNoticeEvent.java" line_range="34-35" />
<code_context>
      * 操作者ID
      */
-    @JsonProperty("operator_id")
+    @JsonProperty("user_id")
     private Long operatorId;

     /**
</code_context>
<issue_to_address>
**suggestion:** Field name `operatorId` no longer matches the JSON property `user_id`, which can be confusing.

Since the wire format is now `user_id` but the field name remains `operatorId`, please either rename the field to match (e.g. `userId`) or confirm that the payload should still use an operator-specific name and adjust the JSON property accordingly.

Suggested implementation:

```java
    /**
     * 操作者ID
     */
    @JsonProperty("user_id")
    private Long userId;

    /**
     * 点赞列表
     */
    @JsonProperty("likes")
    private List<Like> likes;

```

The field rename from `operatorId` to `userId` will also require:
1. Updating any getters/setters (e.g. `getOperatorId`/`setOperatorId`) in this class to `getUserId`/`setUserId`.
2. Updating all references to `operatorId`, `getOperatorId()`, and `setOperatorId(...)` across the codebase (including builders, mappers, tests, and serialization/deserialization logic) to use `userId`, `getUserId()`, and `setUserId(...)` respectively.
3. If Lombok is used (e.g. `@Data`, `@Getter`, `@Setter`), ensure there are no explicit methods or annotations still tied to `operatorId`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +34 to 35
@JsonProperty("user_id")
private Long operatorId;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: 字段名 operatorId 现在与 JSON 属性 user_id 不再匹配,这可能会让人困惑。

由于当前传输格式已经是 user_id,但字段名仍然是 operatorId,请考虑将字段重命名为与之匹配(例如 userId),或者确认负载是否仍应使用与“操作者”相关的命名,并据此调整 JSON 属性。

建议的实现:

    /**
     * 操作者ID
     */
    @JsonProperty("user_id")
    private Long userId;

    /**
     * 点赞列表
     */
    @JsonProperty("likes")
    private List<Like> likes;

将字段从 operatorId 重命名为 userId 还需要:

  1. 在该类中更新对应的 getter/setter(例如将 getOperatorId/setOperatorId 改为 getUserId/setUserId)。
  2. 在整个代码库中(包括构建器、映射器、测试以及序列化/反序列化逻辑)更新所有对 operatorIdgetOperatorId()setOperatorId(...) 的引用,使其改为使用 userIdgetUserId()setUserId(...)
  3. 如果使用了 Lombok(例如 @Data@Getter@Setter),请确保没有任何显式方法或注解仍然绑定在 operatorId 上。
Original comment in English

suggestion: Field name operatorId no longer matches the JSON property user_id, which can be confusing.

Since the wire format is now user_id but the field name remains operatorId, please either rename the field to match (e.g. userId) or confirm that the payload should still use an operator-specific name and adjust the JSON property accordingly.

Suggested implementation:

    /**
     * 操作者ID
     */
    @JsonProperty("user_id")
    private Long userId;

    /**
     * 点赞列表
     */
    @JsonProperty("likes")
    private List<Like> likes;

The field rename from operatorId to userId will also require:

  1. Updating any getters/setters (e.g. getOperatorId/setOperatorId) in this class to getUserId/setUserId.
  2. Updating all references to operatorId, getOperatorId(), and setOperatorId(...) across the codebase (including builders, mappers, tests, and serialization/deserialization logic) to use userId, getUserId(), and setUserId(...) respectively.
  3. If Lombok is used (e.g. @Data, @Getter, @Setter), ensure there are no explicit methods or annotations still tied to operatorId.

@MisakaTAT
Copy link
Copy Markdown
Owner

这个结构是基于哪个客户端的呀?

@TinyTsuki
Copy link
Copy Markdown
Contributor Author

这个结构是基于哪个客户端的呀?

napcat

@MisakaTAT
Copy link
Copy Markdown
Owner

直接新增一个userId字段吧,旧的不改了 直接Deprecated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants