Skip to content

feat(zohocliq): Full Thread support with Title and Posting Options#175

Merged
guanguans merged 1 commit intoguanguans:mainfrom
ricardoapaes:add_support_thread_messages_zoho_cliq
Nov 28, 2025
Merged

feat(zohocliq): Full Thread support with Title and Posting Options#175
guanguans merged 1 commit intoguanguans:mainfrom
ricardoapaes:add_support_thread_messages_zoho_cliq

Conversation

@ricardoapaes
Copy link
Contributor

@ricardoapaes ricardoapaes commented Nov 27, 2025

User description

feat(zohocliq): Full Thread support with Title and Posting Options

This feature expands thread support in Zoho Cliq, allowing for more granular control over how the discussion is initiated and posted.

New Parameters Added:

  • thread_message_id: The ID of the parent message to reply to (as in the previous feature).
  • thread_title: Allows setting a specific title for the thread, making it easier to organize discussions in the channel.
  • post_in_parent: An optional boolean that controls whether the reply should also be posted in the parent channel, in addition to the thread.

Implementation Details:

  • Adds the optional thread_title and post_in_parent fields to the message sending function.
  • Updates the Zoho Cliq API call to include these new parameters, allowing users to configure the thread as needed.

PR Type

Enhancement


Description

  • Add thread support with title and posting options to Zoho Cliq messages

  • Introduce ThreadConfig trait with helper methods for thread configuration

  • Add three new optional parameters: thread_message_id, thread_title, post_in_parent

  • Update channel and chat message classes to support thread functionality

  • Add test coverage for new thread configuration methods


Diagram Walkthrough

flowchart LR
  A["Message Classes<br/>ChannelMessage<br/>ChatMessage"] -->|"use"| B["ThreadConfig Trait"]
  B -->|"provides"| C["setThreadId()"]
  B -->|"provides"| D["setThreadTitle()"]
  B -->|"provides"| E["setThreadPostInParent()"]
  C -->|"sets"| F["thread_message_id"]
  D -->|"sets"| G["thread_title"]
  E -->|"sets"| H["post_in_parent"]
Loading

File Walkthrough

Relevant files
Enhancement
ThreadConfig.php
New trait for thread configuration methods                             

src/ZohoCliq/Messages/ThreadConfig.php

  • New trait providing thread configuration functionality
  • Implements setThreadId() method to format and set thread message ID
    from two integer slices
  • Implements setThreadTitle() method to set custom thread title
  • Implements setThreadPostInParent() method to enable posting in parent
    channel
+38/-0   
Message.php
Add thread configuration trait and fields                               

src/ZohoCliq/Messages/Message.php

  • Add ThreadConfig trait usage to base Message class
  • Add three new thread-related fields to $defined array:
    thread_message_id, thread_title, post_in_parent
  • Enable all message subclasses to inherit thread configuration
    capabilities
+6/-0     
ChannelMessage.php
Add thread fields to channel messages                                       

src/ZohoCliq/Messages/ChannelMessage.php

  • Add three thread-related fields to $defined array: thread_message_id,
    thread_title, post_in_parent
  • Enable channel messages to support thread functionality
+5/-0     
ChatMessage.php
Add thread fields to chat messages                                             

src/ZohoCliq/Messages/ChatMessage.php

  • Add three thread-related fields to $defined array: thread_message_id,
    thread_title, post_in_parent
  • Enable chat messages to support thread functionality
+5/-0     
Tests
ClientTest.php
Add thread configuration tests                                                     

tests/ZohoCliq/ClientTest.php

  • Update channel message test to use new thread configuration methods
  • Update chat message test to use new thread configuration methods
  • Add calls to setThreadId(), setThreadTitle(), and
    setThreadPostInParent() in test cases
+10/-2   
ClientTest.php
Add thread configuration to webhook tests                               

tests/ZohoCliqWebHook/ClientTest.php

  • Add thread configuration method calls to webhook test case
  • Test setThreadId(), setThreadTitle(), and setThreadPostInParent()
    methods
+4/-1     

@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ef88fb9) to head (2d39706).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##                main      #175   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       475       478    +3     
===========================================
  Files            159       160    +1     
  Lines           1700      1709    +9     
===========================================
+ Hits            1700      1709    +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@guanguans guanguans marked this pull request as ready for review November 28, 2025 07:19
@qodo-code-review
Copy link

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
Missing audit logs: New thread-related actions (setting thread ID, title, and posting in parent) do not add
any logging to create an audit trail of these critical messaging actions.

Referred Code
final public function setThreadId(int $slice01, int $slice02): self
{
    $this->options['thread_message_id'] = \sprintf('%s_%s', $slice01, $slice02);

    return $this;
}

final public function setThreadTitle(string $title): self
{
    $this->options['thread_title'] = $title;

    return $this;
}

final public function setThreadPostInParent(): self
{
    $this->options['post_in_parent'] = true;

    return $this;

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Missing validation: The setters accept inputs (e.g., thread ID slices and title) without validation or error
handling for invalid ranges, empty titles, or type/format issues.

Referred Code
final public function setThreadId(int $slice01, int $slice02): self
{
    $this->options['thread_message_id'] = \sprintf('%s_%s', $slice01, $slice02);

    return $this;
}

final public function setThreadTitle(string $title): self
{
    $this->options['thread_title'] = $title;

    return $this;
}

final public function setThreadPostInParent(): self
{
    $this->options['post_in_parent'] = true;

    return $this;

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Unvalidated inputs: External input fields (thread_message_id, thread_title, post_in_parent) are set directly
without sanitization or constraints, which may allow invalid or malicious data to
propagate to API calls.

Referred Code
final public function setThreadId(int $slice01, int $slice02): self
{
    $this->options['thread_message_id'] = \sprintf('%s_%s', $slice01, $slice02);

    return $this;
}

final public function setThreadTitle(string $title): self
{
    $this->options['thread_title'] = $title;

    return $this;
}

final public function setThreadPostInParent(): self
{
    $this->options['post_in_parent'] = true;

    return $this;

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@guanguans
Copy link
Owner

@ricardoapaes Thanks.

@guanguans guanguans merged commit bc54ad8 into guanguans:main Nov 28, 2025
12 of 15 checks passed
@qodo-code-review
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Improve thread ID method flexibility

Modify the setThreadId method to accept a single string argument for the message
ID instead of two integers, ensuring compatibility with the Zoho Cliq API and
preventing potential integer overflow issues.

src/ZohoCliq/Messages/ThreadConfig.php [18-23]

-final public function setThreadId(int $slice01, int $slice02): self
+final public function setThreadId(string $messageId): self
 {
-    $this->options['thread_message_id'] = \sprintf('%s_%s', $slice01, $slice02);
+    $this->options['thread_message_id'] = $messageId;
 
     return $this;
 }
  • Apply / Chat
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that the implementation of setThreadId generates a thread_message_id in a format that likely mismatches the Zoho Cliq API, which would break the new threading feature.

High
  • More

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants