Add IM\ChatUser service for im.chat.user.* API support#467
Add IM\ChatUser service for im.chat.user.* API support#467
Conversation
- ChatUser service wraps im.chat.user.add, im.chat.user.delete, im.chat.user.list - ChatUserListResult returns flat int[] of participant user IDs - IMServiceBuilder::chatUser() exposes the new service - Unit and integration tests added - phpunit.xml.dist suite integration_tests_im_chat_user added - Makefile target test-integration-im-chat-user added
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86d065dcdf
ℹ️ 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".
| public function add(int $chatId, array $userIds, bool $hideHistory = false): UpdatedItemResult | ||
| { | ||
| return new UpdatedItemResult($this->core->call('im.chat.user.add', [ | ||
| 'CHAT_ID' => $chatId, | ||
| 'USERS' => $userIds, | ||
| 'HIDE_HISTORY' => $hideHistory ? 'Y' : 'N', |
There was a problem hiding this comment.
Preserve API default history hiding in chatUser add
When add() is called without the third argument, this implementation sends HIDE_HISTORY = 'N', which inverts the Bitrix24 method default (Y) and exposes prior chat history to newly added users. This is a behavior regression for callers relying on API defaults and can leak historical messages unless every call site explicitly opts in to hiding history.
Useful? React with 👍 / 👎.
Description
This PR implements a new
ChatUserservice undersrc/Services/IM/Chat/Service/that wraps three Bitrix24 REST API methods for managing chat participants:im.chat.user.add— Add participants to a chatim.chat.user.delete— Remove a participant from a chatim.chat.user.list— List participant user IDs of a chatChanges
New files:
src/Services/IM/Chat/Service/ChatUser.php— Service class with three public methods (add,delete,list)src/Services/IM/Chat/Result/ChatUserListResult.php— Result class for thelistmethod, providinggetUserIds(): int[]tests/Unit/Services/IM/Chat/Service/ChatUserTest.php— Unit test verifying service instantiationtests/Integration/Services/IM/Chat/Service/ChatUserTest.php— Integration tests covering all three methodsModified files:
src/Services/IM/IMServiceBuilder.php— AddedchatUser(): ChatUseraccessor method with service cachingphpunit.xml.dist— Addedintegration_tests_im_chat_usertest suiteMakefile— Addedtest-integration-im-chat-usertargetCHANGELOG.md— Documented the new featureUsage Example
Testing
NullCoretestList— Creates a chat and verifies participant listtestAdd— Adds a user and verifies they appear in the participant listtestDelete— Removes a user and verifies successAll tests pass and comply with deptrac layer constraints.
https://claude.ai/code/session_012fip6Y4VZxNBCHGhBDXM9H