@@ -493,13 +493,16 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
493493 readonly onArchiveThread : ( thread : EnvironmentThreadShell ) => void ;
494494 readonly onPinThread : ( thread : EnvironmentThreadShell ) => void ;
495495 readonly onUnpinThread : ( thread : EnvironmentThreadShell ) => void ;
496+ readonly onSetThreadAutoSettle : ( thread : EnvironmentThreadShell , enabled : boolean ) => void ;
496497 /** False on environments whose server predates thread.settle/unsettle:
497498 swipe + menu fall back to Archive instead of failing on use. */
498499 readonly settlementSupported : boolean ;
499500 /** False on servers that predate thread.snooze/unsnooze. */
500501 readonly snoozeSupported : boolean ;
501502 /** False on servers that predate thread.pin/unpin. */
502503 readonly pinningSupported : boolean ;
504+ /** False on servers that predate thread.auto-settle.set. */
505+ readonly autoSettleOptOutSupported : boolean ;
503506 /** False on servers that predate thread title regeneration. */
504507 readonly titleRegenerationSupported : boolean ;
505508 /** Server supports reordering this card's section. */
@@ -536,6 +539,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
536539 onArchiveThread,
537540 onPinThread,
538541 onUnpinThread,
542+ onSetThreadAutoSettle,
539543 onMoveThread,
540544 } = props ;
541545 const snoozedRow = props . snoozed === true ;
@@ -583,6 +587,10 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
583587 const handleUnsettle = useCallback ( ( ) => onUnsettleThread ( thread ) , [ onUnsettleThread , thread ] ) ;
584588 const handlePin = useCallback ( ( ) => onPinThread ( thread ) , [ onPinThread , thread ] ) ;
585589 const handleUnpin = useCallback ( ( ) => onUnpinThread ( thread ) , [ onUnpinThread , thread ] ) ;
590+ const handleSetAutoSettle = useCallback (
591+ ( enabled : boolean ) => onSetThreadAutoSettle ( thread , enabled ) ,
592+ [ onSetThreadAutoSettle , thread ] ,
593+ ) ;
586594 const handleMoveUp = useCallback ( ( ) => onMoveThread ?.( thread , "up" ) , [ onMoveThread , thread ] ) ;
587595 const handleMoveDown = useCallback ( ( ) => onMoveThread ?.( thread , "down" ) , [ onMoveThread , thread ] ) ;
588596 const handleArchive = useCallback ( ( ) => onArchiveThread ( thread ) , [ onArchiveThread , thread ] ) ;
@@ -661,6 +669,33 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
661669 variant ,
662670 ] ,
663671 ) ;
672+ // A submenu with the current option checked, matching web. This is a
673+ // per-thread setting, not a lifecycle verb.
674+ const autoSettleMenuItems = useMemo < MenuAction [ ] > (
675+ ( ) =>
676+ props . autoSettleOptOutSupported
677+ ? [
678+ {
679+ id : "auto-settle" ,
680+ title : "Auto-settle behavior" ,
681+ image : "timer" ,
682+ subactions : [
683+ {
684+ id : "auto-settle:enabled" ,
685+ title : "Enabled" ,
686+ state : thread . autoSettleDisabledAt == null ? "on" : "off" ,
687+ } ,
688+ {
689+ id : "auto-settle:disabled" ,
690+ title : "Disabled" ,
691+ state : thread . autoSettleDisabledAt == null ? "off" : "on" ,
692+ } ,
693+ ] ,
694+ } satisfies MenuAction ,
695+ ]
696+ : [ ] ,
697+ [ props . autoSettleOptOutSupported , thread . autoSettleDisabledAt ] ,
698+ ) ;
664699 const titleMenuItems = useMemo < MenuAction [ ] > (
665700 ( ) => [
666701 { id : "rename" , title : "Rename" , image : "square.and.pencil" } ,
@@ -682,33 +717,43 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
682717 } ,
683718 ...arrangementMenuItems ,
684719 ...titleMenuItems ,
720+ ...autoSettleMenuItems ,
685721 { id : "delete" , title : "Delete" , image : "trash" , attributes : { destructive : true } } ,
686722 ] ,
687- [ arrangementMenuItems , snoozePresetActions , titleMenuItems ] ,
723+ [ arrangementMenuItems , autoSettleMenuItems , snoozePresetActions , titleMenuItems ] ,
688724 ) ;
689725 const cardMenuActions = useMemo < MenuAction [ ] > (
690726 ( ) => [
691727 CARD_MENU_ACTIONS [ 0 ] ! ,
692728 ...arrangementMenuItems ,
693729 ...titleMenuItems ,
730+ ...autoSettleMenuItems ,
694731 ...CARD_MENU_ACTIONS . slice ( 1 ) ,
695732 ] ,
696- [ arrangementMenuItems , titleMenuItems ] ,
733+ [ arrangementMenuItems , autoSettleMenuItems , titleMenuItems ] ,
697734 ) ;
735+ // Settled and snoozed rows keep the setting too, matching web where every
736+ // row shares one menu builder.
698737 const slimMenuActions = useMemo < MenuAction [ ] > (
699738 ( ) => [
700739 SLIM_MENU_ACTIONS [ 0 ] ! ,
701740 ...arrangementMenuItems . filter (
702741 ( action ) => action . id !== "move-up" && action . id !== "move-down" ,
703742 ) ,
704743 ...titleMenuItems ,
744+ ...autoSettleMenuItems ,
705745 SLIM_MENU_ACTIONS [ 1 ] ! ,
706746 ] ,
707- [ arrangementMenuItems , titleMenuItems ] ,
747+ [ arrangementMenuItems , autoSettleMenuItems , titleMenuItems ] ,
708748 ) ;
709749 const snoozedMenuActions = useMemo < MenuAction [ ] > (
710- ( ) => [ SNOOZED_MENU_ACTIONS [ 0 ] ! , ...titleMenuItems , SNOOZED_MENU_ACTIONS [ 1 ] ! ] ,
711- [ titleMenuItems ] ,
750+ ( ) => [
751+ SNOOZED_MENU_ACTIONS [ 0 ] ! ,
752+ ...titleMenuItems ,
753+ ...autoSettleMenuItems ,
754+ SNOOZED_MENU_ACTIONS [ 1 ] ! ,
755+ ] ,
756+ [ autoSettleMenuItems , titleMenuItems ] ,
712757 ) ;
713758 const legacyMenuActions = useMemo < MenuAction [ ] > (
714759 ( ) => [
@@ -727,6 +772,8 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
727772 if ( nativeEvent . event === "unsnooze" ) handleUnsnooze ( ) ;
728773 if ( nativeEvent . event === "pin" ) handlePin ( ) ;
729774 if ( nativeEvent . event === "unpin" ) handleUnpin ( ) ;
775+ if ( nativeEvent . event === "auto-settle:enabled" ) handleSetAutoSettle ( true ) ;
776+ if ( nativeEvent . event === "auto-settle:disabled" ) handleSetAutoSettle ( false ) ;
730777 if ( nativeEvent . event === "arrange" ) appAtomRegistry . set ( threadArrangementOpenAtom , true ) ;
731778 if ( nativeEvent . event === "move-up" ) handleMoveUp ( ) ;
732779 if ( nativeEvent . event === "move-down" ) handleMoveDown ( ) ;
@@ -764,6 +811,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
764811 handlePin ,
765812 handleSettle ,
766813 handleSnooze ,
814+ handleSetAutoSettle ,
767815 handleUnpin ,
768816 handleUnsettle ,
769817 handleUnsnooze ,
0 commit comments