Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix: workspace setting keys in frontend
Stevenc133f5528ac0
diff --git a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsxindex 43757da10..ac43a91c6 100644--- a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx+++ b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx@@ -52,7 +52,7 @@ const AddMemoRelationPopover = (props: Props) => {}const { memos } = await memoServiceClient.listMemos({parent: user.name,- filter: conditions.length > 0 ? conditions.join(" AND ") : undefined,+ filter: conditions.length > 0 ? conditions.join(" && ") : undefined,pageSize: DEFAULT_LIST_MEMOS_PAGE_SIZE,});setFetchedMemos(memos);diff --git a/web/src/components/Settings/MemoRelatedSettings.tsx b/web/src/components/Settings/MemoRelatedSettings.tsxindex 6bc2e8efe..263d16ac0 100644--- a/web/src/components/Settings/MemoRelatedSettings.tsx+++ b/web/src/components/Settings/MemoRelatedSettings.tsx@@ -9,8 +9,8 @@ import { Input } from "@/components/ui/input";import { Switch } from "@/components/ui/switch";import { workspaceStore } from "@/store";import { workspaceSettingNamePrefix } from "@/store/common";-import { WorkspaceSettingKey } from "@/store/workspace";import { WorkspaceMemoRelatedSetting } from "@/types/proto/api/v1/workspace_service";+import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";import { useTranslate } from "@/utils/i18n";const MemoRelatedSettings = observer(() => {diff --git a/web/src/components/Settings/StorageSection.tsx b/web/src/components/Settings/StorageSection.tsxindex 93749a72d..7bd6a528c 100644--- a/web/src/components/Settings/StorageSection.tsx+++ b/web/src/components/Settings/StorageSection.tsx@@ -13,12 +13,12 @@ import { Switch } from "@/components/ui/switch";import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";import { workspaceStore } from "@/store";import { workspaceSettingNamePrefix } from "@/store/common";-import { WorkspaceSettingKey } from "@/store/workspace";import {WorkspaceStorageSetting,WorkspaceStorageSetting_S3Config,WorkspaceStorageSetting_StorageType,} from "@/types/proto/api/v1/workspace_service";+import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";import { useTranslate } from "@/utils/i18n";const StorageSection = observer(() => {diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/WorkspaceSection.tsxindex ddb393d0f..70be2787a 100644--- a/web/src/components/Settings/WorkspaceSection.tsx+++ b/web/src/components/Settings/WorkspaceSection.tsx@@ -13,9 +13,9 @@ import { identityProviderServiceClient } from "@/grpcweb";import useDialog from "@/hooks/useDialog";import { workspaceStore } from "@/store";import { workspaceSettingNamePrefix } from "@/store/common";-import { WorkspaceSettingKey } from "@/store/workspace";import { IdentityProvider } from "@/types/proto/api/v1/idp_service";import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_service";+import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";import { useTranslate } from "@/utils/i18n";import ThemeSelector from "../ThemeSelector";import UpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog";diff --git a/web/src/components/UpdateCustomizedProfileDialog.tsx b/web/src/components/UpdateCustomizedProfileDialog.tsxindex c0b0dceb9..699f3304d 100644--- a/web/src/components/UpdateCustomizedProfileDialog.tsx+++ b/web/src/components/UpdateCustomizedProfileDialog.tsx@@ -7,8 +7,8 @@ import { Label } from "@/components/ui/label";import { Textarea } from "@/components/ui/textarea";import { workspaceStore } from "@/store";import { workspaceSettingNamePrefix } from "@/store/common";-import { WorkspaceSettingKey } from "@/store/workspace";import { WorkspaceCustomProfile } from "@/types/proto/api/v1/workspace_service";+import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";import { useTranslate } from "@/utils/i18n";import AppearanceSelect from "./AppearanceSelect";import LocaleSelect from "./LocaleSelect";diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsxindex e5b3176df..e5048187d 100644--- a/web/src/pages/Home.tsx+++ b/web/src/pages/Home.tsx@@ -4,10 +4,11 @@ import { useMemo } from "react";import MemoView from "@/components/MemoView";import PagedMemoList from "@/components/PagedMemoList";import useCurrentUser from "@/hooks/useCurrentUser";-import { viewStore, userStore } from "@/store";+import { viewStore, userStore, workspaceStore } from "@/store";import memoFilterStore from "@/store/memoFilter";import { State } from "@/types/proto/api/v1/common";import { Memo } from "@/types/proto/api/v1/memo_service";+import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";// Helper function to extract shortcut ID from resource name// Format: users/{user}/shortcuts/{shortcut}@@ -39,10 +40,13 @@ const Home = observer(() => {} else if (filter.factor === "property.hasCode") {conditions.push(`has_code`);} else if (filter.factor === "displayTime") {+ const displayWithUpdateTime = workspaceStore.getWorkspaceSettingByKey(WorkspaceSettingKey.MEMO_RELATED).memoRelatedSetting+ ?.displayWithUpdateTime;+ const factor = displayWithUpdateTime ? "updated_ts" : "created_ts";const filterDate = new Date(filter.value);const filterUtcTimestamp = filterDate.getTime() + filterDate.getTimezoneOffset() * 60 * 1000;const timestampAfter = filterUtcTimestamp / 1000;- conditions.push(`created_ts >= ${timestampAfter} AND created_ts < ${timestampAfter + 60 * 60 * 24}`);+ conditions.push(`${factor} >= ${timestampAfter} && ${factor} < ${timestampAfter + 60 * 60 * 24}`);}}return conditions.length > 0 ? conditions.join(" && ") : undefined;diff --git a/web/src/pages/Setting.tsx b/web/src/pages/Setting.tsxindex f16e0870e..c10c85aef 100644--- a/web/src/pages/Setting.tsx+++ b/web/src/pages/Setting.tsx@@ -15,8 +15,8 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@import useCurrentUser from "@/hooks/useCurrentUser";import useResponsiveWidth from "@/hooks/useResponsiveWidth";import { workspaceStore } from "@/store";-import { WorkspaceSettingKey } from "@/store/workspace";import { User_Role } from "@/types/proto/api/v1/user_service";+import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";import { useTranslate } from "@/utils/i18n";type SettingSection = "my-account" | "preference" | "member" | "system" | "memo-related" | "storage" | "sso";diff --git a/web/src/store/workspace.ts b/web/src/store/workspace.tsindex 2fba97416..81bf55ffb 100644--- a/web/src/store/workspace.ts+++ b/web/src/store/workspace.ts@@ -3,20 +3,10 @@ import { makeAutoObservable } from "mobx";import { workspaceServiceClient } from "@/grpcweb";import { WorkspaceProfile } from "@/types/proto/api/v1/workspace_service";import { WorkspaceGeneralSetting, WorkspaceMemoRelatedSetting, WorkspaceSetting } from "@/types/proto/api/v1/workspace_service";+import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";import { isValidateLocale } from "@/utils/i18n";import { workspaceSettingNamePrefix } from "./common";-export enum WorkspaceSettingKey {- /** BASIC - BASIC is the key for basic settings. */- BASIC = "BASIC",- /** GENERAL - GENERAL is the key for general settings. */- GENERAL = "GENERAL",- /** STORAGE - STORAGE is the key for storage settings. */- STORAGE = "STORAGE",- /** MEMO_RELATED - MEMO_RELATED is the key for memo related settings. */- MEMO_RELATED = "MEMO_RELATED",-}-class LocalState {locale: string = "en";appearance: string = "system";