MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / withDateNotePatternHistory

Function withDateNotePatternHistory

packages/app-core/src/store.ts:2778–2818  ·  view source on GitHub ↗
(
  previousSettings: VaultSettings,
  requestedSettings: VaultSettings
)

Source from the content-addressed store, hash-verified

2776}
2777
2778function withDateNotePatternHistory(
2779 previousSettings: VaultSettings,
2780 requestedSettings: VaultSettings
2781): VaultSettings {
2782 const previous = normalizeVaultSettings(previousSettings)
2783 const next = normalizeVaultSettings(requestedSettings)
2784 const previousDaily = currentDailyPatternFromSettings(previous)
2785 const nextDaily = currentDailyPatternFromSettings(next)
2786 const previousWeekly = currentWeeklyPatternFromSettings(previous)
2787 const nextWeekly = currentWeeklyPatternFromSettings(next)
2788
2789 return {
2790 ...next,
2791 dailyNotes: {
2792 ...next.dailyNotes,
2793 legacyPatterns:
2794 previous.dailyNotes.enabled &&
2795 next.dailyNotes.enabled &&
2796 dateNotePatternKey(previousDaily) !== dateNotePatternKey(nextDaily)
2797 ? appendDateNotePatternHistory(
2798 next.dailyNotes.legacyPatterns,
2799 previousDaily,
2800 nextDaily
2801 )
2802 : next.dailyNotes.legacyPatterns
2803 },
2804 weeklyNotes: {
2805 ...next.weeklyNotes,
2806 legacyPatterns:
2807 previous.weeklyNotes.enabled &&
2808 next.weeklyNotes.enabled &&
2809 dateNotePatternKey(previousWeekly) !== dateNotePatternKey(nextWeekly)
2810 ? appendDateNotePatternHistory(
2811 next.weeklyNotes.legacyPatterns,
2812 previousWeekly,
2813 nextWeekly
2814 )
2815 : next.weeklyNotes.legacyPatterns
2816 }
2817 }
2818}
2819
2820function rewriteNoteCommentsPath(
2821 comments: Record<string, NoteComment[]>,

Callers 1

store.tsFile · 0.85

Tested by

no test coverage detected