Skip to content

fix(custom-bot-slack): dependsOn incorrectly set for bot_token#2214

Merged
icecrasher321 merged 3 commits intostagingfrom
fix/custom-bot-slack
Dec 5, 2025
Merged

fix(custom-bot-slack): dependsOn incorrectly set for bot_token#2214
icecrasher321 merged 3 commits intostagingfrom
fix/custom-bot-slack

Conversation

@icecrasher321
Copy link
Copy Markdown
Collaborator

@icecrasher321 icecrasher321 commented Dec 5, 2025

Summary

  • Custom Bot Token dependsOn
  • Add abstraction for either/or dependsOn

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel bot commented Dec 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Dec 5, 2025 9:52pm

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Dec 5, 2025

Greptile Overview

Greptile Summary

This PR fixes a bug where the Slack channel selector was incorrectly disabled when using Custom Bot authentication (bot token) instead of OAuth. The fix introduces a more flexible dependency system that supports both AND (all) and OR (any) logic.

  • Extended dependsOn type to accept { all?: string[]; any?: string[] } in addition to simple arrays
  • Updated the useDependsOnGate hook with a parseDependsOn function that handles both formats
  • Changed Slack channel selector to require authMethod (AND) while allowing either credential OR botToken (OR)
  • Maintained backward compatibility - existing array-based dependsOn configurations continue to work

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it's a well-contained bug fix with backward-compatible changes.
  • The changes are focused and well-implemented. The new dependency format is backward-compatible, the logic is correct, and the fix properly addresses the reported issue. No security concerns or potential regressions identified.
  • No files require special attention.

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/blocks/blocks/slack.ts 5/5 Fixed channel selector dependsOn to use new all/any format, enabling it when either OAuth credential or bot token is provided while always requiring authMethod.
apps/sim/blocks/types.ts 5/5 Extended dependsOn type to support object format with all/any arrays for AND/OR dependency logic.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate.ts 5/5 Added parseDependsOn function and updated hook to handle both all (AND) and any (OR) dependency logic with backward compatibility.

Sequence Diagram

sequenceDiagram
    participant User
    participant SlackBlock
    participant ChannelSelector
    participant useDependsOnGate
    participant parseDependsOn

    User->>SlackBlock: Select "Custom Bot" auth method
    User->>SlackBlock: Enter bot token
    SlackBlock->>ChannelSelector: Render with dependsOn config
    ChannelSelector->>useDependsOnGate: Check dependencies
    useDependsOnGate->>parseDependsOn: Parse {all: ['authMethod'], any: ['credential', 'botToken']}
    parseDependsOn-->>useDependsOnGate: allFields=['authMethod'], anyFields=['credential', 'botToken']
    useDependsOnGate->>useDependsOnGate: Check allFields satisfied (authMethod ✓)
    useDependsOnGate->>useDependsOnGate: Check anyFields satisfied (botToken ✓)
    useDependsOnGate-->>ChannelSelector: depsSatisfied=true, blocked=false
    ChannelSelector-->>User: Channel selector enabled
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@icecrasher321 icecrasher321 merged commit fb4c982 into staging Dec 5, 2025
5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/custom-bot-slack branch December 7, 2025 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant