feat(event): 更新消息表情点赞通知事件结构#397
Conversation
审查者指南(在小型 PR 上折叠显示)审查者指南调整消息表情符号点赞通知事件负载,使其与更新后的 API 字段名保持一致,并新增一个标志,用于指示该事件对应的是添加还是移除表情反应。 文件级更改
技巧与命令与 Sourcery 交互
自定义你的使用体验访问你的 dashboard 以:
获取帮助Original review guide in EnglishReviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts 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
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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>请帮我变得更有用!你可以对每条评论点 👍 或 👎,我会根据你的反馈改进之后的评审。
Original comment in English
Hey - I've found 1 issue, and left some high level feedback:
- The
operatorIdfield is now mapped fromuser_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 primitivebooleaninstead ofBooleanwill 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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| @JsonProperty("user_id") | ||
| private Long operatorId; |
There was a problem hiding this comment.
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 还需要:
- 在该类中更新对应的 getter/setter(例如将
getOperatorId/setOperatorId改为getUserId/setUserId)。 - 在整个代码库中(包括构建器、映射器、测试以及序列化/反序列化逻辑)更新所有对
operatorId、getOperatorId()和setOperatorId(...)的引用,使其改为使用userId、getUserId()和setUserId(...)。 - 如果使用了 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:
- Updating any getters/setters (e.g.
getOperatorId/setOperatorId) in this class togetUserId/setUserId. - Updating all references to
operatorId,getOperatorId(), andsetOperatorId(...)across the codebase (including builders, mappers, tests, and serialization/deserialization logic) to useuserId,getUserId(), andsetUserId(...)respectively. - If Lombok is used (e.g.
@Data,@Getter,@Setter), ensure there are no explicit methods or annotations still tied tooperatorId.
|
这个结构是基于哪个客户端的呀? |
napcat |
|
直接新增一个userId字段吧,旧的不改了 直接Deprecated |
Summary by Sourcery
更新消息表情点赞通知事件结构,以与最新的通知负载字段保持一致。
增强内容:
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: