feat: Add isGroup support to detect group chats#71
feat: Add isGroup support to detect group chats#71PeterRosdahl wants to merge 2 commits intosteipete:mainfrom
Conversation
- Add isGroup boolean to Message struct - JOIN chat table in SQL queries to fetch chat.style - Map chat.style == 43 to isGroup = true - Add is_group field to JSON output
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51987ef150
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| : "" | ||
| var sql = """ | ||
| SELECT m.ROWID, m.handle_id, h.id, IFNULL(m.text, '') AS text, m.date, m.is_from_me, m.service, | ||
| c.style AS chat_style, |
There was a problem hiding this comment.
Guard group flag query against missing
chat.style
The new SQL now unconditionally reads c.style (here and again in messagesAfter), but this repository intentionally runs against schema variants where chat.style is absent (for example, Tests/IMsgCoreTests/MessageStoreTestHelpers.swift defines chat without a style column), so these queries will fail at runtime with no such column: c.style instead of returning messages. Since other optional fields are already feature-gated, this needs the same schema check/fallback (e.g., select a literal and default isGroup to false when the column is unavailable).
Useful? React with 👍 / 👎.
- Add schema check for chat.style column existence - Default isGroup to false when style column unavailable - Add regression test for missing style column Addresses review feedback about test schema compatibility.
Summary
Adds the ability to detect whether a message is from a group chat.
Changes
isGroupboolean toMessagestructchattable and fetchchat.stylechat.style == 43→isGroup = trueis_groupfield to JSON outputTesting
Tested with synthetic data by copying chat.db and modifying
styleto verify both cases:style=45→is_group: false✅style=43→is_group: true✅Usage
Note: Apologies for PR #70 which was closed - I was a bit too quick on the keyboard and submitted before proper testing. This one has been verified.