File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -554,6 +554,38 @@ describe("handleFeishuMessage command authorization", () => {
554554 expect ( mockDispatchReplyFromConfig ) . not . toHaveBeenCalled ( ) ;
555555 } ) ;
556556
557+ it ( "drops message when groupConfig.enabled is false" , async ( ) => {
558+ const cfg : ClawdbotConfig = {
559+ channels : {
560+ feishu : {
561+ groups : {
562+ "oc-disabled-group" : {
563+ enabled : false ,
564+ } ,
565+ } ,
566+ } ,
567+ } ,
568+ } as ClawdbotConfig ;
569+
570+ const event : FeishuMessageEvent = {
571+ sender : {
572+ sender_id : { open_id : "ou-sender" } ,
573+ } ,
574+ message : {
575+ message_id : "msg-disabled-group" ,
576+ chat_id : "oc-disabled-group" ,
577+ chat_type : "group" ,
578+ message_type : "text" ,
579+ content : JSON . stringify ( { text : "hello" } ) ,
580+ } ,
581+ } ;
582+
583+ await dispatchMessage ( { cfg, event } ) ;
584+
585+ expect ( mockFinalizeInboundContext ) . not . toHaveBeenCalled ( ) ;
586+ expect ( mockDispatchReplyFromConfig ) . not . toHaveBeenCalled ( ) ;
587+ } ) ;
588+
557589 it ( "uses video file_key (not thumbnail image_key) for inbound video download" , async ( ) => {
558590 mockShouldComputeCommandAuthorized . mockReturnValue ( false ) ;
559591
Original file line number Diff line number Diff line change @@ -742,6 +742,10 @@ export async function handleFeishuMessage(params: {
742742 const useAccessGroups = cfg . commands ?. useAccessGroups !== false ;
743743
744744 if ( isGroup ) {
745+ if ( groupConfig ?. enabled === false ) {
746+ log ( `feishu[${ account . accountId } ]: group ${ ctx . chatId } is disabled` ) ;
747+ return ;
748+ }
745749 const defaultGroupPolicy = resolveDefaultGroupPolicy ( cfg ) ;
746750 const { groupPolicy, providerMissingFallbackApplied } = resolveOpenProviderRuntimeGroupPolicy ( {
747751 providerConfigPresent : cfg . channels ?. feishu !== undefined ,
@@ -766,7 +770,9 @@ export async function handleFeishuMessage(params: {
766770 } ) ;
767771
768772 if ( ! groupAllowed ) {
769- log ( `feishu[${ account . accountId } ]: sender ${ ctx . senderOpenId } not in group allowlist` ) ;
773+ log (
774+ `feishu[${ account . accountId } ]: group ${ ctx . chatId } not in groupAllowFrom (groupPolicy=${ groupPolicy } )` ,
775+ ) ;
770776 return ;
771777 }
772778
You can’t perform that action at this time.
0 commit comments