feat: add notifyOnSubtasks setting to control subtask notifications (#227)
* feat: add notifyOnSubtasks setting to control subtask notifications - Add notifyOnSubtasks toggle in NotificationSettings (moved to general section) - Update useEventStream.ts to skip notifications for subtasks when disabled - Add server-side push notification control for subtasks - Update UI store, persistence, and desktop settings types * feat: apply notifyOnSubtasks across web push + desktop notifications --------- Co-authored-by: Jovines <jovines@qq.com>
This commit is contained in:
committed by
GitHub
co-authored by
Jovines
parent
344f369093
commit
de468361ec
@@ -150,6 +150,7 @@ export const useEventStream = () => {
|
||||
const { checkConnection } = useConfigStore();
|
||||
const nativeNotificationsEnabled = useUIStore((state) => state.nativeNotificationsEnabled);
|
||||
const notificationMode = useUIStore((state) => state.notificationMode);
|
||||
const notifyOnSubtasks = useUIStore((state) => state.notifyOnSubtasks);
|
||||
const fallbackDirectory = useDirectoryStore((state) => state.currentDirectory);
|
||||
|
||||
const activeSessionDirectory = React.useMemo(() => {
|
||||
@@ -1310,6 +1311,17 @@ export const useEventStream = () => {
|
||||
const shouldNotify = notificationMode === 'always' || visibilityStateRef.current === 'hidden';
|
||||
|
||||
if (shouldNotify) {
|
||||
// Check if this is a subtask and if we should notify for subtasks
|
||||
if (!notifyOnSubtasks) {
|
||||
const sessions = useSessionStore.getState().sessions;
|
||||
const session = sessions.find(s => s.id === sessionId);
|
||||
const isSubtask = session && 'parentID' in session && Boolean((session as { parentID?: string }).parentID);
|
||||
if (isSubtask) {
|
||||
// Skip notification for subtasks
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const notifiedMessages = notifiedMessagesRef.current;
|
||||
|
||||
if (!notifiedMessages.has(messageId)) {
|
||||
@@ -1610,6 +1622,7 @@ export const useEventStream = () => {
|
||||
currentSessionId,
|
||||
nativeNotificationsEnabled,
|
||||
notificationMode,
|
||||
notifyOnSubtasks,
|
||||
addStreamingPart,
|
||||
completeStreamingMessage,
|
||||
updateMessageInfo,
|
||||
@@ -2095,6 +2108,7 @@ export const useEventStream = () => {
|
||||
loadSessions,
|
||||
maybeBootstrapIfStale,
|
||||
resyncMessages,
|
||||
scheduleSoftResync
|
||||
scheduleSoftResync,
|
||||
notifyOnSubtasks,
|
||||
]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user