Conversation
Contributor
Reviewer's Guide将群公告类型重构为复用共享接口,更新群公告获取逻辑以包含带置顶信息和条件排序的 更新后 GetGroupNotice 处理流程的时序图sequenceDiagram
actor Client
participant GetGroupNotice
participant Ctx
participant NtGroupApi
Client->>GetGroupNotice: invoke _handle(payload)
GetGroupNotice->>Ctx: access ntGroupApi
Ctx-->>GetGroupNotice: ntGroupApi
GetGroupNotice->>NtGroupApi: getGroupBulletinList(group_id)
NtGroupApi-->>GetGroupNotice: GroupBulletinListResult data
GetGroupNotice->>GetGroupNotice: merge [...data.feeds, ...data.inst]
loop for each feed
GetGroupNotice->>GetGroupNotice: map feed to Notice
GetGroupNotice->>GetGroupNotice: settings.is_show_edit_card = !!isShowEditCard
GetGroupNotice->>GetGroupNotice: settings.tip_window = !tipWindowType
GetGroupNotice->>GetGroupNotice: settings.confirm_required = !!confirmRequired
GetGroupNotice->>GetGroupNotice: settings.pinned = !!pinned
end
alt data.inst.length > 0
GetGroupNotice->>GetGroupNotice: sort result by publish_time desc
end
GetGroupNotice-->>Client: Notice[] result
更新后的群公告类型与 GetGroupNotice 的类图classDiagram
class GroupBulletinFeed {
string uin
string feedId
string publishTime
number type
number fn
number cn
number vn
number pinned
number readNum
number is_read
number is_all_confirm
}
class GroupBulletinFeedMsg {
string text
string textFace
GroupBulletinFeedPic[] pics
string title
}
class GroupBulletinFeedPic {
string id
number width
number height
}
class GroupBulletinFeedSettings {
number isShowEditCard
number remindTs
number tipWindowType
number confirmRequired
}
class GroupBulletinListResult {
string groupCode
number srvCode
number readOnly
number role
GroupBulletinFeed[] inst
GroupBulletinFeed[] feeds
}
class Notice {
string notice_id
number sender_id
number publish_time
string message
string image
boolean is_pinned
NoticeSettings settings
}
class NoticeSettings {
boolean is_show_edit_card
boolean tip_window
boolean confirm_required
boolean pinned
}
class BaseAction {
<<abstract>>
}
class GetGroupNotice {
+_handle(payload)
}
class Ctx {
NtGroupApi ntGroupApi
}
class NtGroupApi {
+getGroupBulletinList(groupId) GroupBulletinListResult
}
GroupBulletinFeed o-- GroupBulletinFeedMsg : msg
GroupBulletinFeedMsg o-- GroupBulletinFeedPic : pics
GroupBulletinFeed o-- GroupBulletinFeedSettings : settings
GroupBulletinListResult o-- GroupBulletinFeed : inst
GroupBulletinListResult o-- GroupBulletinFeed : feeds
Notice o-- NoticeSettings : settings
GetGroupNotice ..|> BaseAction
GetGroupNotice --> Ctx : uses
Ctx o-- NtGroupApi : has
GetGroupNotice --> NtGroupApi : calls
GetGroupNotice --> Notice : returns
文件级变更
Tips and commandsInteracting with Sourcery
Customizing Your Experience打开你的 dashboard 来:
Getting HelpOriginal review guide in EnglishReviewer's GuideRefactors the group bulletin types to reuse a shared interface, updates the group notice retrieval to include Sequence diagram for updated GetGroupNotice processingsequenceDiagram
actor Client
participant GetGroupNotice
participant Ctx
participant NtGroupApi
Client->>GetGroupNotice: invoke _handle(payload)
GetGroupNotice->>Ctx: access ntGroupApi
Ctx-->>GetGroupNotice: ntGroupApi
GetGroupNotice->>NtGroupApi: getGroupBulletinList(group_id)
NtGroupApi-->>GetGroupNotice: GroupBulletinListResult data
GetGroupNotice->>GetGroupNotice: merge [...data.feeds, ...data.inst]
loop for each feed
GetGroupNotice->>GetGroupNotice: map feed to Notice
GetGroupNotice->>GetGroupNotice: settings.is_show_edit_card = !!isShowEditCard
GetGroupNotice->>GetGroupNotice: settings.tip_window = !tipWindowType
GetGroupNotice->>GetGroupNotice: settings.confirm_required = !!confirmRequired
GetGroupNotice->>GetGroupNotice: settings.pinned = !!pinned
end
alt data.inst.length > 0
GetGroupNotice->>GetGroupNotice: sort result by publish_time desc
end
GetGroupNotice-->>Client: Notice[] result
Class diagram for updated group bulletin types and GetGroupNoticeclassDiagram
class GroupBulletinFeed {
string uin
string feedId
string publishTime
number type
number fn
number cn
number vn
number pinned
number readNum
number is_read
number is_all_confirm
}
class GroupBulletinFeedMsg {
string text
string textFace
GroupBulletinFeedPic[] pics
string title
}
class GroupBulletinFeedPic {
string id
number width
number height
}
class GroupBulletinFeedSettings {
number isShowEditCard
number remindTs
number tipWindowType
number confirmRequired
}
class GroupBulletinListResult {
string groupCode
number srvCode
number readOnly
number role
GroupBulletinFeed[] inst
GroupBulletinFeed[] feeds
}
class Notice {
string notice_id
number sender_id
number publish_time
string message
string image
boolean is_pinned
NoticeSettings settings
}
class NoticeSettings {
boolean is_show_edit_card
boolean tip_window
boolean confirm_required
boolean pinned
}
class BaseAction {
<<abstract>>
}
class GetGroupNotice {
+_handle(payload)
}
class Ctx {
NtGroupApi ntGroupApi
}
class NtGroupApi {
+getGroupBulletinList(groupId) GroupBulletinListResult
}
GroupBulletinFeed o-- GroupBulletinFeedMsg : msg
GroupBulletinFeedMsg o-- GroupBulletinFeedPic : pics
GroupBulletinFeed o-- GroupBulletinFeedSettings : settings
GroupBulletinListResult o-- GroupBulletinFeed : inst
GroupBulletinListResult o-- GroupBulletinFeed : feeds
Notice o-- NoticeSettings : settings
GetGroupNotice ..|> BaseAction
GetGroupNotice --> Ctx : uses
Ctx o-- NtGroupApi : has
GetGroupNotice --> NtGroupApi : calls
GetGroupNotice --> Notice : returns
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - 我在这里给出了一些总体反馈:
- 将
GroupBulletinFeed同时复用于feeds和inst,假设它们始终具有完全相同的结构(包括settings和pinned);如果inst的结构可能不同或只被部分填充,建议将部分字段改为可选,或者为其定义一个更具体的类型,以避免在类型定义中固化运行时才成立的假设。 - 目前按
publish_time排序只会在data.inst.length > 0时执行;如果希望无论通知来源如何都保持一致的排序行为,那么始终对合并后的数组做排序可能会更清晰,也更不容易让人产生误解。
给 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- Reusing `GroupBulletinFeed` for both `feeds` and `inst` assumes they always share the exact same shape (including `settings` and `pinned`); if `inst` can differ or be partially populated, consider making some fields optional or defining a more specific type to avoid runtime assumptions being baked into the typings.
- The sorting by `publish_time` only runs when `data.inst.length > 0`; if consistent ordering is desired regardless of where the notices come from, it may be clearer and less surprising to always sort the combined array.帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进未来的评审。
Original comment in English
Hey - I've left some high level feedback:
- Reusing
GroupBulletinFeedfor bothfeedsandinstassumes they always share the exact same shape (includingsettingsandpinned); ifinstcan differ or be partially populated, consider making some fields optional or defining a more specific type to avoid runtime assumptions being baked into the typings. - The sorting by
publish_timeonly runs whendata.inst.length > 0; if consistent ordering is desired regardless of where the notices come from, it may be clearer and less surprising to always sort the combined array.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Reusing `GroupBulletinFeed` for both `feeds` and `inst` assumes they always share the exact same shape (including `settings` and `pinned`); if `inst` can differ or be partially populated, consider making some fields optional or defining a more specific type to avoid runtime assumptions being baked into the typings.
- The sorting by `publish_time` only runs when `data.inst.length > 0`; if consistent ordering is desired regardless of where the notices come from, it may be clearer and less surprising to always sort the combined array.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Test Report
✅ All tests passed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
更新群公告处理逻辑并提升项目版本。
New Features:
Enhancements:
GroupBulletinFeed接口重构群公告类型。7.12.6。Original summary in English
Summary by Sourcery
Update group bulletin handling and bump the project version.
New Features:
Enhancements: