@@ -2837,6 +2837,73 @@ describe("handleFeishuMessage command authorization", () => {
28372837 expectResolvedRouteCall ( 1 , { kind : "group" , id : "oc-group:topic:omt_native_topic" } ) ;
28382838 } ) ;
28392839
2840+ it . each ( [
2841+ {
2842+ action : "created" ,
2843+ scope : "group_topic" ,
2844+ expectedPeerId : "oc-group:topic:omt_native_reaction" ,
2845+ } ,
2846+ {
2847+ action : "deleted" ,
2848+ scope : "group_topic" ,
2849+ expectedPeerId : "oc-group:topic:omt_native_reaction" ,
2850+ } ,
2851+ {
2852+ action : "created" ,
2853+ scope : "group_topic_sender" ,
2854+ expectedPeerId : "oc-group:topic:omt_native_reaction:sender:ou-reaction-actor" ,
2855+ } ,
2856+ {
2857+ action : "deleted" ,
2858+ scope : "group_topic_sender" ,
2859+ expectedPeerId : "oc-group:topic:omt_native_reaction:sender:ou-reaction-actor" ,
2860+ } ,
2861+ ] as const ) (
2862+ "hydrates topic threads from the real message ID for synthetic $action reactions in $scope sessions" ,
2863+ async ( { action, scope, expectedPeerId } ) => {
2864+ mockShouldComputeCommandAuthorized . mockReturnValue ( false ) ;
2865+ const reactedMessageId = `om_reacted_${ action } _${ scope } ` ;
2866+ mockGetMessageFeishu . mockResolvedValueOnce ( {
2867+ messageId : reactedMessageId ,
2868+ chatId : "oc-group" ,
2869+ chatType : "topic_group" ,
2870+ content : "reacted message" ,
2871+ contentType : "text" ,
2872+ threadId : "omt_native_reaction" ,
2873+ } ) ;
2874+
2875+ await dispatchMessage ( {
2876+ cfg : createFeishuTestConfig ( {
2877+ groups : {
2878+ "oc-group" : {
2879+ requireMention : false ,
2880+ groupSessionScope : scope ,
2881+ replyInThread : "enabled" ,
2882+ } ,
2883+ } ,
2884+ } ) ,
2885+ event : createFeishuTestEvent ( {
2886+ messageId : `${ reactedMessageId } :reaction:THUMBSUP:synthetic` ,
2887+ senderOpenId : "ou-reaction-actor" ,
2888+ chatId : "oc-group" ,
2889+ chatType : "topic_group" ,
2890+ text :
2891+ action === "deleted"
2892+ ? `[removed reaction THUMBSUP from message ${ reactedMessageId } ]`
2893+ : `[reacted with THUMBSUP to message ${ reactedMessageId } ]` ,
2894+ message : {
2895+ reply_target_message_id : reactedMessageId ,
2896+ typing_target_message_id : reactedMessageId ,
2897+ } ,
2898+ } ) ,
2899+ } ) ;
2900+
2901+ const getMessageRequest = mockCallArg < { messageId ?: string } > ( mockGetMessageFeishu , 0 , 0 ) ;
2902+ expect ( getMessageRequest . messageId ) . toBe ( reactedMessageId ) ;
2903+ expectResolvedRouteCall ( 0 , { kind : "group" , id : expectedPeerId } ) ;
2904+ } ,
2905+ ) ;
2906+
28402907 it . each ( [
28412908 {
28422909 name : "replies to the topic root when handling a message inside an existing topic" ,
0 commit comments