Skip to content

armgit / memos

Public Imported from GitHub
0

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.

chore: enable location by default

johnnyjoyee99afd7a411
diff --git a/proto/api/v1/workspace_setting_service.proto b/proto/api/v1/workspace_setting_service.proto
index bd18daa8f..92fa51928 100644
--- a/proto/api/v1/workspace_setting_service.proto
+++ b/proto/api/v1/workspace_setting_service.proto
@@ -96,7 +96,7 @@ message WorkspaceStorageSetting {
}
message WorkspaceMemoRelatedSetting {
- reserved 4;
+ reserved 4, 8;
// disallow_public_visibility disallows set memo as public visibility.
bool disallow_public_visibility = 1;
@@ -110,8 +110,6 @@ message WorkspaceMemoRelatedSetting {
bool enable_link_preview = 6;
// enable_comment enables comment.
bool enable_comment = 7;
- // enable_location enables setting location for memo.
- bool enable_location = 8;
// reactions is the list of reactions.
repeated string reactions = 10;
// disable_markdown_shortcuts disallow the registration of markdown shortcuts.
diff --git a/proto/gen/api/v1/workspace_setting_service.pb.go b/proto/gen/api/v1/workspace_setting_service.pb.go
index ee095a377..b08d20ab1 100644
--- a/proto/gen/api/v1/workspace_setting_service.pb.go
+++ b/proto/gen/api/v1/workspace_setting_service.pb.go
@@ -458,8 +458,6 @@ type WorkspaceMemoRelatedSetting struct {
EnableLinkPreview bool `protobuf:"varint,6,opt,name=enable_link_preview,json=enableLinkPreview,proto3" json:"enable_link_preview,omitempty"`
// enable_comment enables comment.
EnableComment bool `protobuf:"varint,7,opt,name=enable_comment,json=enableComment,proto3" json:"enable_comment,omitempty"`
- // enable_location enables setting location for memo.
- EnableLocation bool `protobuf:"varint,8,opt,name=enable_location,json=enableLocation,proto3" json:"enable_location,omitempty"`
// reactions is the list of reactions.
Reactions []string `protobuf:"bytes,10,rep,name=reactions,proto3" json:"reactions,omitempty"`
// disable_markdown_shortcuts disallow the registration of markdown shortcuts.
@@ -544,13 +542,6 @@ func (x *WorkspaceMemoRelatedSetting) GetEnableComment() bool {
return false
}
-func (x *WorkspaceMemoRelatedSetting) GetEnableLocation() bool {
- if x != nil {
- return x.EnableLocation
- }
- return false
-}
-
func (x *WorkspaceMemoRelatedSetting) GetReactions() []string {
if x != nil {
return x.Reactions
@@ -799,20 +790,19 @@ const file_api_v1_workspace_setting_service_proto_rawDesc = "" +
"\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\f\n" +
"\bDATABASE\x10\x01\x12\t\n" +
"\x05LOCAL\x10\x02\x12\x06\n" +
- "\x02S3\x10\x03\"\xb7\x04\n" +
+ "\x02S3\x10\x03\"\x94\x04\n" +
"\x1bWorkspaceMemoRelatedSetting\x12<\n" +
"\x1adisallow_public_visibility\x18\x01 \x01(\bR\x18disallowPublicVisibility\x127\n" +
"\x18display_with_update_time\x18\x02 \x01(\bR\x15displayWithUpdateTime\x120\n" +
"\x14content_length_limit\x18\x03 \x01(\x05R\x12contentLengthLimit\x127\n" +
"\x18enable_double_click_edit\x18\x05 \x01(\bR\x15enableDoubleClickEdit\x12.\n" +
"\x13enable_link_preview\x18\x06 \x01(\bR\x11enableLinkPreview\x12%\n" +
- "\x0eenable_comment\x18\a \x01(\bR\renableComment\x12'\n" +
- "\x0fenable_location\x18\b \x01(\bR\x0eenableLocation\x12\x1c\n" +
+ "\x0eenable_comment\x18\a \x01(\bR\renableComment\x12\x1c\n" +
"\treactions\x18\n" +
" \x03(\tR\treactions\x12<\n" +
"\x1adisable_markdown_shortcuts\x18\v \x01(\bR\x18disableMarkdownShortcuts\x127\n" +
"\x18enable_blur_nsfw_content\x18\f \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" +
- "\tnsfw_tags\x18\r \x03(\tR\bnsfwTagsJ\x04\b\x04\x10\x05\"5\n" +
+ "\tnsfw_tags\x18\r \x03(\tR\bnsfwTagsJ\x04\b\x04\x10\x05J\x04\b\b\x10\t\"5\n" +
"\x1aGetWorkspaceSettingRequest\x12\x17\n" +
"\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"V\n" +
"\x1aSetWorkspaceSettingRequest\x128\n" +
diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml
index a6589e3ab..49e5ec070 100644
--- a/proto/gen/apidocs.swagger.yaml
+++ b/proto/gen/apidocs.swagger.yaml
@@ -2308,9 +2308,6 @@ definitions:
enableComment:
type: boolean
description: enable_comment enables comment.
- enableLocation:
- type: boolean
- description: enable_location enables setting location for memo.
reactions:
type: array
items:
diff --git a/proto/gen/store/workspace_setting.pb.go b/proto/gen/store/workspace_setting.pb.go
index b706b74a1..2a97b6123 100644
--- a/proto/gen/store/workspace_setting.pb.go
+++ b/proto/gen/store/workspace_setting.pb.go
@@ -669,8 +669,6 @@ type WorkspaceMemoRelatedSetting struct {
EnableLinkPreview bool `protobuf:"varint,6,opt,name=enable_link_preview,json=enableLinkPreview,proto3" json:"enable_link_preview,omitempty"`
// enable_comment enables comment.
EnableComment bool `protobuf:"varint,7,opt,name=enable_comment,json=enableComment,proto3" json:"enable_comment,omitempty"`
- // enable_location enables setting location for memo.
- EnableLocation bool `protobuf:"varint,8,opt,name=enable_location,json=enableLocation,proto3" json:"enable_location,omitempty"`
// reactions is the list of reactions.
Reactions []string `protobuf:"bytes,10,rep,name=reactions,proto3" json:"reactions,omitempty"`
// disable markdown shortcuts
@@ -755,13 +753,6 @@ func (x *WorkspaceMemoRelatedSetting) GetEnableComment() bool {
return false
}
-func (x *WorkspaceMemoRelatedSetting) GetEnableLocation() bool {
- if x != nil {
- return x.EnableLocation
- }
- return false
-}
-
func (x *WorkspaceMemoRelatedSetting) GetReactions() []string {
if x != nil {
return x.Reactions
@@ -839,20 +830,19 @@ const file_store_workspace_setting_proto_rawDesc = "" +
"\bendpoint\x18\x03 \x01(\tR\bendpoint\x12\x16\n" +
"\x06region\x18\x04 \x01(\tR\x06region\x12\x16\n" +
"\x06bucket\x18\x05 \x01(\tR\x06bucket\x12$\n" +
- "\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\"\xb7\x04\n" +
+ "\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\"\x94\x04\n" +
"\x1bWorkspaceMemoRelatedSetting\x12<\n" +
"\x1adisallow_public_visibility\x18\x01 \x01(\bR\x18disallowPublicVisibility\x127\n" +
"\x18display_with_update_time\x18\x02 \x01(\bR\x15displayWithUpdateTime\x120\n" +
"\x14content_length_limit\x18\x03 \x01(\x05R\x12contentLengthLimit\x127\n" +
"\x18enable_double_click_edit\x18\x05 \x01(\bR\x15enableDoubleClickEdit\x12.\n" +
"\x13enable_link_preview\x18\x06 \x01(\bR\x11enableLinkPreview\x12%\n" +
- "\x0eenable_comment\x18\a \x01(\bR\renableComment\x12'\n" +
- "\x0fenable_location\x18\b \x01(\bR\x0eenableLocation\x12\x1c\n" +
+ "\x0eenable_comment\x18\a \x01(\bR\renableComment\x12\x1c\n" +
"\treactions\x18\n" +
" \x03(\tR\treactions\x12<\n" +
"\x1adisable_markdown_shortcuts\x18\v \x01(\bR\x18disableMarkdownShortcuts\x127\n" +
"\x18enable_blur_nsfw_content\x18\f \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" +
- "\tnsfw_tags\x18\r \x03(\tR\bnsfwTagsJ\x04\b\x04\x10\x05*s\n" +
+ "\tnsfw_tags\x18\r \x03(\tR\bnsfwTagsJ\x04\b\x04\x10\x05J\x04\b\b\x10\t*s\n" +
"\x13WorkspaceSettingKey\x12%\n" +
"!WORKSPACE_SETTING_KEY_UNSPECIFIED\x10\x00\x12\t\n" +
"\x05BASIC\x10\x01\x12\v\n" +
diff --git a/proto/store/workspace_setting.proto b/proto/store/workspace_setting.proto
index c8b714c01..e5ca90684 100644
--- a/proto/store/workspace_setting.proto
+++ b/proto/store/workspace_setting.proto
@@ -95,7 +95,7 @@ message StorageS3Config {
}
message WorkspaceMemoRelatedSetting {
- reserved 4;
+ reserved 4, 8;
// disallow_public_visibility disallows set memo as public visibility.
bool disallow_public_visibility = 1;
@@ -109,8 +109,6 @@ message WorkspaceMemoRelatedSetting {
bool enable_link_preview = 6;
// enable_comment enables comment.
bool enable_comment = 7;
- // enable_location enables setting location for memo.
- bool enable_location = 8;
// reactions is the list of reactions.
repeated string reactions = 10;
// disable markdown shortcuts
diff --git a/server/router/api/v1/workspace_setting_service.go b/server/router/api/v1/workspace_setting_service.go
index 626b6de1b..634091b03 100644
--- a/server/router/api/v1/workspace_setting_service.go
+++ b/server/router/api/v1/workspace_setting_service.go
@@ -229,7 +229,6 @@ func convertWorkspaceMemoRelatedSettingFromStore(setting *storepb.WorkspaceMemoR
EnableDoubleClickEdit: setting.EnableDoubleClickEdit,
EnableLinkPreview: setting.EnableLinkPreview,
EnableComment: setting.EnableComment,
- EnableLocation: setting.EnableLocation,
Reactions: setting.Reactions,
DisableMarkdownShortcuts: setting.DisableMarkdownShortcuts,
EnableBlurNsfwContent: setting.EnableBlurNsfwContent,
@@ -248,7 +247,6 @@ func convertWorkspaceMemoRelatedSettingToStore(setting *v1pb.WorkspaceMemoRelate
EnableDoubleClickEdit: setting.EnableDoubleClickEdit,
EnableLinkPreview: setting.EnableLinkPreview,
EnableComment: setting.EnableComment,
- EnableLocation: setting.EnableLocation,
Reactions: setting.Reactions,
DisableMarkdownShortcuts: setting.DisableMarkdownShortcuts,
EnableBlurNsfwContent: setting.EnableBlurNsfwContent,
diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx
index b14c0d0e6..1098e5ed8 100644
--- a/web/src/components/MemoEditor/index.tsx
+++ b/web/src/components/MemoEditor/index.tsx
@@ -507,17 +507,15 @@ const MemoEditor = observer((props: Props) => {
<MarkdownMenu editorRef={editorRef} />
<UploadResourceButton isUploadingResource={state.isUploadingResource} />
<AddMemoRelationPopover editorRef={editorRef} />
- {workspaceMemoRelatedSetting.enableLocation && (
- <LocationSelector
- location={state.location}
- onChange={(location) =>
- setState((prevState) => ({
- ...prevState,
- location,
- }))
- }
- />
- )}
+ <LocationSelector
+ location={state.location}
+ onChange={(location) =>
+ setState((prevState) => ({
+ ...prevState,
+ location,
+ }))
+ }
+ />
</div>
</div>
<Divider className="!mt-2 opacity-40" />
diff --git a/web/src/components/Settings/MemoRelatedSettings.tsx b/web/src/components/Settings/MemoRelatedSettings.tsx
index 19b844ec2..15b3129f2 100644
--- a/web/src/components/Settings/MemoRelatedSettings.tsx
+++ b/web/src/components/Settings/MemoRelatedSettings.tsx
@@ -93,13 +93,6 @@ const MemoRelatedSettings = () => {
onChange={(event) => updatePartialSetting({ enableComment: event.target.checked })}
/>
</div>
- <div className="w-full flex flex-row justify-between items-center">
- <span>{t("setting.memo-related-settings.enable-memo-location")}</span>
- <Switch
- checked={memoRelatedSetting.enableLocation}
- onChange={(event) => updatePartialSetting({ enableLocation: event.target.checked })}
- />
- </div>
<div className="w-full flex flex-row justify-between items-center">
<span>{t("setting.system-section.enable-double-click-to-edit")}</span>
<Switch
diff --git a/web/src/types/proto/api/v1/workspace_setting_service.ts b/web/src/types/proto/api/v1/workspace_setting_service.ts
index 4477d8ad4..6d0c5d34a 100644
--- a/web/src/types/proto/api/v1/workspace_setting_service.ts
+++ b/web/src/types/proto/api/v1/workspace_setting_service.ts
@@ -138,8 +138,6 @@ export interface WorkspaceMemoRelatedSetting {
enableLinkPreview: boolean;
/** enable_comment enables comment. */
enableComment: boolean;
- /** enable_location enables setting location for memo. */
- enableLocation: boolean;
/** reactions is the list of reactions. */
reactions: string[];
/** disable_markdown_shortcuts disallow the registration of markdown shortcuts. */
@@ -689,7 +687,6 @@ function createBaseWorkspaceMemoRelatedSetting(): WorkspaceMemoRelatedSetting {
enableDoubleClickEdit: false,
enableLinkPreview: false,
enableComment: false,
- enableLocation: false,
reactions: [],
disableMarkdownShortcuts: false,
enableBlurNsfwContent: false,
@@ -717,9 +714,6 @@ export const WorkspaceMemoRelatedSetting: MessageFns<WorkspaceMemoRelatedSetting
if (message.enableComment !== false) {
writer.uint32(56).bool(message.enableComment);
}
- if (message.enableLocation !== false) {
- writer.uint32(64).bool(message.enableLocation);
- }
for (const v of message.reactions) {
writer.uint32(82).string(v!);
}
@@ -790,14 +784,6 @@ export const WorkspaceMemoRelatedSetting: MessageFns<WorkspaceMemoRelatedSetting
message.enableComment = reader.bool();
continue;
}
- case 8: {
- if (tag !== 64) {
- break;
- }
-
- message.enableLocation = reader.bool();
- continue;
- }
case 10: {
if (tag !== 82) {
break;
@@ -850,7 +836,6 @@ export const WorkspaceMemoRelatedSetting: MessageFns<WorkspaceMemoRelatedSetting
message.enableDoubleClickEdit = object.enableDoubleClickEdit ?? false;
message.enableLinkPreview = object.enableLinkPreview ?? false;
message.enableComment = object.enableComment ?? false;
- message.enableLocation = object.enableLocation ?? false;
message.reactions = object.reactions?.map((e) => e) || [];
message.disableMarkdownShortcuts = object.disableMarkdownShortcuts ?? false;
message.enableBlurNsfwContent = object.enableBlurNsfwContent ?? false;