@@ -4,10 +4,9 @@ import {
44 resolveChannelEntryMatchWithFallback ,
55 type ChannelMatchSource ,
66} from "openclaw/plugin-sdk/channel-targets" ;
7- import type { SlackReactionNotificationMode } from "openclaw/plugin-sdk/config-types" ;
87import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime" ;
98import type { SlackMessageEvent } from "../types.js" ;
10- import { allowListMatches , normalizeAllowListLower , normalizeSlackSlug } from "./allow-list.js" ;
9+ import { normalizeSlackSlug } from "./allow-list.js" ;
1110
1211export type SlackChannelConfigResolved = {
1312 allowed : boolean ;
@@ -40,41 +39,6 @@ function firstDefined<T>(...values: Array<T | undefined>) {
4039 return undefined ;
4140}
4241
43- export function shouldEmitSlackReactionNotification ( params : {
44- mode : SlackReactionNotificationMode | undefined ;
45- botId ?: string | null ;
46- messageAuthorId ?: string | null ;
47- userId : string ;
48- userName ?: string | null ;
49- allowlist ?: Array < string | number > | null ;
50- allowNameMatching ?: boolean ;
51- } ) {
52- const { mode, botId, messageAuthorId, userId, userName, allowlist } = params ;
53- const effectiveMode = mode ?? "own" ;
54- if ( effectiveMode === "off" ) {
55- return false ;
56- }
57- if ( effectiveMode === "own" ) {
58- if ( ! botId || ! messageAuthorId ) {
59- return false ;
60- }
61- return messageAuthorId === botId ;
62- }
63- if ( effectiveMode === "allowlist" ) {
64- if ( ! Array . isArray ( allowlist ) || allowlist . length === 0 ) {
65- return false ;
66- }
67- const users = normalizeAllowListLower ( allowlist ) ;
68- return allowListMatches ( {
69- allowList : users ,
70- id : userId ,
71- name : userName ?? undefined ,
72- allowNameMatching : params . allowNameMatching ,
73- } ) ;
74- }
75- return true ;
76- }
77-
7842export function resolveSlackChannelLabel ( params : { channelId ?: string ; channelName ?: string } ) {
7943 const channelName = params . channelName ?. trim ( ) ;
8044 if ( channelName ) {
0 commit comments