chore: enable memo comments by default

pull/4922/head
Steven 3 months ago
parent 5074268f4f
commit 1fcafd807e

@ -162,8 +162,6 @@ message WorkspaceSetting {
bool enable_double_click_edit = 4;
// enable_link_preview enables links preview.
bool enable_link_preview = 5;
// enable_comment enables comment.
bool enable_comment = 6;
// reactions is the list of reactions.
repeated string reactions = 7;
// disable_markdown_shortcuts disallow the registration of markdown shortcuts.

@ -665,8 +665,6 @@ type WorkspaceSetting_MemoRelatedSetting struct {
EnableDoubleClickEdit bool `protobuf:"varint,4,opt,name=enable_double_click_edit,json=enableDoubleClickEdit,proto3" json:"enable_double_click_edit,omitempty"`
// enable_link_preview enables links preview.
EnableLinkPreview bool `protobuf:"varint,5,opt,name=enable_link_preview,json=enableLinkPreview,proto3" json:"enable_link_preview,omitempty"`
// enable_comment enables comment.
EnableComment bool `protobuf:"varint,6,opt,name=enable_comment,json=enableComment,proto3" json:"enable_comment,omitempty"`
// reactions is the list of reactions.
Reactions []string `protobuf:"bytes,7,rep,name=reactions,proto3" json:"reactions,omitempty"`
// disable_markdown_shortcuts disallow the registration of markdown shortcuts.
@ -744,13 +742,6 @@ func (x *WorkspaceSetting_MemoRelatedSetting) GetEnableLinkPreview() bool {
return false
}
func (x *WorkspaceSetting_MemoRelatedSetting) GetEnableComment() bool {
if x != nil {
return x.EnableComment
}
return false
}
func (x *WorkspaceSetting_MemoRelatedSetting) GetReactions() []string {
if x != nil {
return x.Reactions
@ -952,7 +943,7 @@ const file_api_v1_workspace_service_proto_rawDesc = "" +
"\aversion\x18\x02 \x01(\tR\aversion\x12\x12\n" +
"\x04mode\x18\x03 \x01(\tR\x04mode\x12!\n" +
"\finstance_url\x18\x06 \x01(\tR\vinstanceUrl\"\x1c\n" +
"\x1aGetWorkspaceProfileRequest\"\xdf\x11\n" +
"\x1aGetWorkspaceProfileRequest\"\xb8\x11\n" +
"\x10WorkspaceSetting\x12\x17\n" +
"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12X\n" +
"\x0fgeneral_setting\x18\x02 \x01(\v2-.memos.api.v1.WorkspaceSetting.GeneralSettingH\x00R\x0egeneralSetting\x12X\n" +
@ -992,14 +983,13 @@ const file_api_v1_workspace_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\x1a\xff\x03\n" +
"\x02S3\x10\x03\x1a\xd8\x03\n" +
"\x12MemoRelatedSetting\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\x04 \x01(\bR\x15enableDoubleClickEdit\x12.\n" +
"\x13enable_link_preview\x18\x05 \x01(\bR\x11enableLinkPreview\x12%\n" +
"\x0eenable_comment\x18\x06 \x01(\bR\renableComment\x12\x1c\n" +
"\x13enable_link_preview\x18\x05 \x01(\bR\x11enableLinkPreview\x12\x1c\n" +
"\treactions\x18\a \x03(\tR\treactions\x12<\n" +
"\x1adisable_markdown_shortcuts\x18\b \x01(\bR\x18disableMarkdownShortcuts\x127\n" +
"\x18enable_blur_nsfw_content\x18\t \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" +

@ -3881,9 +3881,6 @@ components:
enableLinkPreview:
type: boolean
description: enable_link_preview enables links preview.
enableComment:
type: boolean
description: enable_comment enables comment.
reactions:
type: array
items:

@ -677,8 +677,6 @@ type WorkspaceMemoRelatedSetting struct {
EnableDoubleClickEdit bool `protobuf:"varint,4,opt,name=enable_double_click_edit,json=enableDoubleClickEdit,proto3" json:"enable_double_click_edit,omitempty"`
// enable_link_preview enables links preview.
EnableLinkPreview bool `protobuf:"varint,5,opt,name=enable_link_preview,json=enableLinkPreview,proto3" json:"enable_link_preview,omitempty"`
// enable_comment enables comment.
EnableComment bool `protobuf:"varint,6,opt,name=enable_comment,json=enableComment,proto3" json:"enable_comment,omitempty"`
// reactions is the list of reactions.
Reactions []string `protobuf:"bytes,7,rep,name=reactions,proto3" json:"reactions,omitempty"`
// disable markdown shortcuts
@ -756,13 +754,6 @@ func (x *WorkspaceMemoRelatedSetting) GetEnableLinkPreview() bool {
return false
}
func (x *WorkspaceMemoRelatedSetting) GetEnableComment() bool {
if x != nil {
return x.EnableComment
}
return false
}
func (x *WorkspaceMemoRelatedSetting) GetReactions() []string {
if x != nil {
return x.Reactions
@ -841,14 +832,13 @@ 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\"\x88\x04\n" +
"\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\"\xe1\x03\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\x04 \x01(\bR\x15enableDoubleClickEdit\x12.\n" +
"\x13enable_link_preview\x18\x05 \x01(\bR\x11enableLinkPreview\x12%\n" +
"\x0eenable_comment\x18\x06 \x01(\bR\renableComment\x12\x1c\n" +
"\x13enable_link_preview\x18\x05 \x01(\bR\x11enableLinkPreview\x12\x1c\n" +
"\treactions\x18\a \x03(\tR\treactions\x12<\n" +
"\x1adisable_markdown_shortcuts\x18\b \x01(\bR\x18disableMarkdownShortcuts\x127\n" +
"\x18enable_blur_nsfw_content\x18\t \x01(\bR\x15enableBlurNsfwContent\x12\x1b\n" +

@ -107,8 +107,6 @@ message WorkspaceMemoRelatedSetting {
bool enable_double_click_edit = 4;
// enable_link_preview enables links preview.
bool enable_link_preview = 5;
// enable_comment enables comment.
bool enable_comment = 6;
// reactions is the list of reactions.
repeated string reactions = 7;
// disable markdown shortcuts

@ -257,7 +257,6 @@ func convertWorkspaceMemoRelatedSettingFromStore(setting *storepb.WorkspaceMemoR
ContentLengthLimit: setting.ContentLengthLimit,
EnableDoubleClickEdit: setting.EnableDoubleClickEdit,
EnableLinkPreview: setting.EnableLinkPreview,
EnableComment: setting.EnableComment,
Reactions: setting.Reactions,
DisableMarkdownShortcuts: setting.DisableMarkdownShortcuts,
EnableBlurNsfwContent: setting.EnableBlurNsfwContent,
@ -275,7 +274,6 @@ func convertWorkspaceMemoRelatedSettingToStore(setting *v1pb.WorkspaceSetting_Me
ContentLengthLimit: setting.ContentLengthLimit,
EnableDoubleClickEdit: setting.EnableDoubleClickEdit,
EnableLinkPreview: setting.EnableLinkPreview,
EnableComment: setting.EnableComment,
Reactions: setting.Reactions,
DisableMarkdownShortcuts: setting.DisableMarkdownShortcuts,
EnableBlurNsfwContent: setting.EnableBlurNsfwContent,

@ -190,7 +190,7 @@ const MemoView: React.FC<Props> = observer((props: Props) => {
)}
{currentUser && !isArchived && <ReactionSelector className="border-none w-auto h-auto" memo={memo} />}
</div>
{!isInMemoDetailPage && (workspaceMemoRelatedSetting.enableComment || commentAmount > 0) && (
{!isInMemoDetailPage && commentAmount > 0 && (
<Link
className={cn(
"flex flex-row justify-start items-center rounded-md p-1 hover:opacity-80",

@ -88,13 +88,6 @@ const MemoRelatedSettings = observer(() => {
onCheckedChange={(checked) => updatePartialSetting({ enableLinkPreview: checked })}
/>
</div>
<div className="w-full flex flex-row justify-between items-center">
<span>{t("setting.memo-related-settings.enable-memo-comments")}</span>
<Switch
checked={memoRelatedSetting.enableComment}
onCheckedChange={(checked) => updatePartialSetting({ enableComment: 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

@ -14,7 +14,6 @@ import useNavigateTo from "@/hooks/useNavigateTo";
import useResponsiveWidth from "@/hooks/useResponsiveWidth";
import { cn } from "@/lib/utils";
import { memoStore } from "@/store";
import { workspaceStore } from "@/store";
import { memoNamePrefix } from "@/store/common";
import { Memo, MemoRelation_Type } from "@/types/proto/api/v1/memo_service";
import { useTranslate } from "@/utils/i18n";
@ -29,13 +28,12 @@ const MemoDetail = observer(() => {
const uid = params.uid;
const memoName = `${memoNamePrefix}${uid}`;
const memo = memoStore.getMemoByName(memoName);
const workspaceMemoRelatedSetting = workspaceStore.state.memoRelatedSetting;
const [parentMemo, setParentMemo] = useState<Memo | undefined>(undefined);
const [showCommentEditor, setShowCommentEditor] = useState(false);
const commentRelations =
memo?.relations.filter((relation) => relation.relatedMemo?.name === memo.name && relation.type === MemoRelation_Type.COMMENT) || [];
const comments = commentRelations.map((relation) => memoStore.getMemoByName(relation.memo!.name)).filter((memo) => memo) as any as Memo[];
const showCreateCommentButton = workspaceMemoRelatedSetting.enableComment && currentUser && !showCommentEditor;
const showCreateCommentButton = currentUser && !showCommentEditor;
// Prepare memo.
useEffect(() => {

@ -223,8 +223,6 @@ export interface WorkspaceSetting_MemoRelatedSetting {
enableDoubleClickEdit: boolean;
/** enable_link_preview enables links preview. */
enableLinkPreview: boolean;
/** enable_comment enables comment. */
enableComment: boolean;
/** reactions is the list of reactions. */
reactions: string[];
/** disable_markdown_shortcuts disallow the registration of markdown shortcuts. */
@ -916,7 +914,6 @@ function createBaseWorkspaceSetting_MemoRelatedSetting(): WorkspaceSetting_MemoR
contentLengthLimit: 0,
enableDoubleClickEdit: false,
enableLinkPreview: false,
enableComment: false,
reactions: [],
disableMarkdownShortcuts: false,
enableBlurNsfwContent: false,
@ -941,9 +938,6 @@ export const WorkspaceSetting_MemoRelatedSetting: MessageFns<WorkspaceSetting_Me
if (message.enableLinkPreview !== false) {
writer.uint32(40).bool(message.enableLinkPreview);
}
if (message.enableComment !== false) {
writer.uint32(48).bool(message.enableComment);
}
for (const v of message.reactions) {
writer.uint32(58).string(v!);
}
@ -1006,14 +1000,6 @@ export const WorkspaceSetting_MemoRelatedSetting: MessageFns<WorkspaceSetting_Me
message.enableLinkPreview = reader.bool();
continue;
}
case 6: {
if (tag !== 48) {
break;
}
message.enableComment = reader.bool();
continue;
}
case 7: {
if (tag !== 58) {
break;
@ -1065,7 +1051,6 @@ export const WorkspaceSetting_MemoRelatedSetting: MessageFns<WorkspaceSetting_Me
message.contentLengthLimit = object.contentLengthLimit ?? 0;
message.enableDoubleClickEdit = object.enableDoubleClickEdit ?? false;
message.enableLinkPreview = object.enableLinkPreview ?? false;
message.enableComment = object.enableComment ?? false;
message.reactions = object.reactions?.map((e) => e) || [];
message.disableMarkdownShortcuts = object.disableMarkdownShortcuts ?? false;
message.enableBlurNsfwContent = object.enableBlurNsfwContent ?? false;

Loading…
Cancel
Save