File tree Expand file tree Collapse file tree
extensions/mattermost/src/mattermost Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,6 +169,17 @@ describe("resolveMattermostEffectiveReplyToId", () => {
169169 ) . toBe ( "thread-root-456" ) ;
170170 } ) ;
171171
172+ it ( "suppresses existing thread roots when replyToMode is off" , ( ) => {
173+ expect (
174+ resolveMattermostEffectiveReplyToId ( {
175+ kind : "channel" ,
176+ postId : "post-123" ,
177+ replyToMode : "off" ,
178+ threadRootId : "thread-root-456" ,
179+ } ) ,
180+ ) . toBeUndefined ( ) ;
181+ } ) ;
182+
172183 it ( "starts a thread for top-level channel messages when replyToMode is all" , ( ) => {
173184 expect (
174185 resolveMattermostEffectiveReplyToId ( {
@@ -232,6 +243,22 @@ describe("resolveMattermostThreadSessionContext", () => {
232243 } ) ;
233244 } ) ;
234245
246+ it ( "keeps threaded messages top-level when replyToMode is off" , ( ) => {
247+ expect (
248+ resolveMattermostThreadSessionContext ( {
249+ baseSessionKey : "agent:main:mattermost:default:chan-1" ,
250+ kind : "group" ,
251+ postId : "post-123" ,
252+ replyToMode : "off" ,
253+ threadRootId : "root-456" ,
254+ } ) ,
255+ ) . toEqual ( {
256+ effectiveReplyToId : undefined ,
257+ sessionKey : "agent:main:mattermost:default:chan-1" ,
258+ parentSessionKey : undefined ,
259+ } ) ;
260+ } ) ;
261+
235262 it ( "keeps direct-message sessions linear" , ( ) => {
236263 expect (
237264 resolveMattermostThreadSessionContext ( {
Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ export function resolveMattermostEffectiveReplyToId(params: {
175175 threadRootId ?: string | null ;
176176} ) : string | undefined {
177177 const threadRootId = params . threadRootId ?. trim ( ) ;
178- if ( threadRootId ) {
178+ if ( threadRootId && params . replyToMode !== "off" ) {
179179 return threadRootId ;
180180 }
181181 if ( params . kind === "direct" ) {
You can’t perform that action at this time.
0 commit comments