mirror of https://github.com/usememos/memos.git
feat(ui): add option to disable reactions
This commit is contained in:
parent
2488a85bb7
commit
3bafab3ea7
|
|
@ -156,6 +156,8 @@ message InstanceSetting {
|
|||
int32 content_length_limit = 3;
|
||||
// enable_double_click_edit enables editing on double click.
|
||||
bool enable_double_click_edit = 4;
|
||||
// disable_reactions disables memo reactions across the UI and API.
|
||||
bool disable_reactions = 8;
|
||||
// reactions is the list of reactions.
|
||||
repeated string reactions = 7;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -654,6 +654,8 @@ type InstanceSetting_MemoRelatedSetting struct {
|
|||
ContentLengthLimit int32 `protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"`
|
||||
// enable_double_click_edit enables editing on double click.
|
||||
EnableDoubleClickEdit bool `protobuf:"varint,4,opt,name=enable_double_click_edit,json=enableDoubleClickEdit,proto3" json:"enable_double_click_edit,omitempty"`
|
||||
// disable_reactions disables memo reactions across the UI and API.
|
||||
DisableReactions bool `protobuf:"varint,8,opt,name=disable_reactions,json=disableReactions,proto3" json:"disable_reactions,omitempty"`
|
||||
// reactions is the list of reactions.
|
||||
Reactions []string `protobuf:"bytes,7,rep,name=reactions,proto3" json:"reactions,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
|
@ -718,6 +720,13 @@ func (x *InstanceSetting_MemoRelatedSetting) GetEnableDoubleClickEdit() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (x *InstanceSetting_MemoRelatedSetting) GetDisableReactions() bool {
|
||||
if x != nil {
|
||||
return x.DisableReactions
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *InstanceSetting_MemoRelatedSetting) GetReactions() []string {
|
||||
if x != nil {
|
||||
return x.Reactions
|
||||
|
|
@ -882,7 +891,7 @@ const file_api_v1_instance_service_proto_rawDesc = "" +
|
|||
"\x04demo\x18\x03 \x01(\bR\x04demo\x12!\n" +
|
||||
"\finstance_url\x18\x06 \x01(\tR\vinstanceUrl\x12 \n" +
|
||||
"\vinitialized\x18\a \x01(\bR\vinitialized\"\x1b\n" +
|
||||
"\x19GetInstanceProfileRequest\"\x99\x0f\n" +
|
||||
"\x19GetInstanceProfileRequest\"\xc6\x0f\n" +
|
||||
"\x0fInstanceSetting\x12\x17\n" +
|
||||
"\x04name\x18\x01 \x01(\tB\x03\xe0A\bR\x04name\x12W\n" +
|
||||
"\x0fgeneral_setting\x18\x02 \x01(\v2,.memos.api.v1.InstanceSetting.GeneralSettingH\x00R\x0egeneralSetting\x12W\n" +
|
||||
|
|
@ -917,12 +926,13 @@ const file_api_v1_instance_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\x94\x02\n" +
|
||||
"\x02S3\x10\x03\x1a\xc1\x02\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\x1c\n" +
|
||||
"\x18enable_double_click_edit\x18\x04 \x01(\bR\x15enableDoubleClickEdit\x12+\n" +
|
||||
"\x11disable_reactions\x18\b \x01(\bR\x10disableReactions\x12\x1c\n" +
|
||||
"\treactions\x18\a \x03(\tR\treactions\"F\n" +
|
||||
"\x03Key\x12\x13\n" +
|
||||
"\x0fKEY_UNSPECIFIED\x10\x00\x12\v\n" +
|
||||
|
|
|
|||
|
|
@ -2212,6 +2212,9 @@ components:
|
|||
enableDoubleClickEdit:
|
||||
type: boolean
|
||||
description: enable_double_click_edit enables editing on double click.
|
||||
disableReactions:
|
||||
type: boolean
|
||||
description: disable_reactions disables memo reactions across the UI and API.
|
||||
reactions:
|
||||
type: array
|
||||
items:
|
||||
|
|
|
|||
|
|
@ -649,6 +649,8 @@ type InstanceMemoRelatedSetting struct {
|
|||
ContentLengthLimit int32 `protobuf:"varint,3,opt,name=content_length_limit,json=contentLengthLimit,proto3" json:"content_length_limit,omitempty"`
|
||||
// enable_double_click_edit enables editing on double click.
|
||||
EnableDoubleClickEdit bool `protobuf:"varint,4,opt,name=enable_double_click_edit,json=enableDoubleClickEdit,proto3" json:"enable_double_click_edit,omitempty"`
|
||||
// disable_reactions disables memo reactions across the UI and API.
|
||||
DisableReactions bool `protobuf:"varint,8,opt,name=disable_reactions,json=disableReactions,proto3" json:"disable_reactions,omitempty"`
|
||||
// reactions is the list of reactions.
|
||||
Reactions []string `protobuf:"bytes,7,rep,name=reactions,proto3" json:"reactions,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
|
@ -713,6 +715,13 @@ func (x *InstanceMemoRelatedSetting) GetEnableDoubleClickEdit() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (x *InstanceMemoRelatedSetting) GetDisableReactions() bool {
|
||||
if x != nil {
|
||||
return x.DisableReactions
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *InstanceMemoRelatedSetting) GetReactions() []string {
|
||||
if x != nil {
|
||||
return x.Reactions
|
||||
|
|
@ -765,12 +774,13 @@ const file_store_instance_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\"\x9c\x02\n" +
|
||||
"\x0euse_path_style\x18\x06 \x01(\bR\fusePathStyle\"\xc9\x02\n" +
|
||||
"\x1aInstanceMemoRelatedSetting\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\x1c\n" +
|
||||
"\x18enable_double_click_edit\x18\x04 \x01(\bR\x15enableDoubleClickEdit\x12+\n" +
|
||||
"\x11disable_reactions\x18\b \x01(\bR\x10disableReactions\x12\x1c\n" +
|
||||
"\treactions\x18\a \x03(\tR\treactions*q\n" +
|
||||
"\x12InstanceSettingKey\x12$\n" +
|
||||
" INSTANCE_SETTING_KEY_UNSPECIFIED\x10\x00\x12\t\n" +
|
||||
|
|
|
|||
|
|
@ -100,6 +100,8 @@ message InstanceMemoRelatedSetting {
|
|||
int32 content_length_limit = 3;
|
||||
// enable_double_click_edit enables editing on double click.
|
||||
bool enable_double_click_edit = 4;
|
||||
// disable_reactions disables memo reactions across the UI and API.
|
||||
bool disable_reactions = 8;
|
||||
// reactions is the list of reactions.
|
||||
repeated string reactions = 7;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -253,6 +253,7 @@ func convertInstanceMemoRelatedSettingFromStore(setting *storepb.InstanceMemoRel
|
|||
DisplayWithUpdateTime: setting.DisplayWithUpdateTime,
|
||||
ContentLengthLimit: setting.ContentLengthLimit,
|
||||
EnableDoubleClickEdit: setting.EnableDoubleClickEdit,
|
||||
DisableReactions: setting.DisableReactions,
|
||||
Reactions: setting.Reactions,
|
||||
}
|
||||
}
|
||||
|
|
@ -266,6 +267,7 @@ func convertInstanceMemoRelatedSettingToStore(setting *v1pb.InstanceSetting_Memo
|
|||
DisplayWithUpdateTime: setting.DisplayWithUpdateTime,
|
||||
ContentLengthLimit: setting.ContentLengthLimit,
|
||||
EnableDoubleClickEdit: setting.EnableDoubleClickEdit,
|
||||
DisableReactions: setting.DisableReactions,
|
||||
Reactions: setting.Reactions,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,12 +249,14 @@ func (s *APIV1Service) ListMemos(ctx context.Context, request *v1pb.ListMemosReq
|
|||
}
|
||||
|
||||
// REACTIONS
|
||||
reactions, err := s.Store.ListReactions(ctx, &store.FindReaction{ContentIDList: contentIDs})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
}
|
||||
for _, reaction := range reactions {
|
||||
reactionMap[reaction.ContentID] = append(reactionMap[reaction.ContentID], reaction)
|
||||
if !instanceMemoRelatedSetting.DisableReactions {
|
||||
reactions, err := s.Store.ListReactions(ctx, &store.FindReaction{ContentIDList: contentIDs})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
}
|
||||
for _, reaction := range reactions {
|
||||
reactionMap[reaction.ContentID] = append(reactionMap[reaction.ContentID], reaction)
|
||||
}
|
||||
}
|
||||
|
||||
// ATTACHMENTS
|
||||
|
|
@ -313,11 +315,18 @@ func (s *APIV1Service) GetMemo(ctx context.Context, request *v1pb.GetMemoRequest
|
|||
}
|
||||
}
|
||||
|
||||
reactions, err := s.Store.ListReactions(ctx, &store.FindReaction{
|
||||
ContentID: &request.Name,
|
||||
})
|
||||
var reactions []*store.Reaction
|
||||
reactionsEnabled, err := s.reactionsEnabled(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
return nil, err
|
||||
}
|
||||
if reactionsEnabled {
|
||||
reactions, err = s.Store.ListReactions(ctx, &store.FindReaction{
|
||||
ContentID: &request.Name,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
}
|
||||
}
|
||||
|
||||
attachments, err := s.Store.ListAttachments(ctx, &store.FindAttachment{
|
||||
|
|
@ -449,11 +458,18 @@ func (s *APIV1Service) UpdateMemo(ctx context.Context, request *v1pb.UpdateMemoR
|
|||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get memo")
|
||||
}
|
||||
reactions, err := s.Store.ListReactions(ctx, &store.FindReaction{
|
||||
ContentID: &request.Memo.Name,
|
||||
})
|
||||
var reactions []*store.Reaction
|
||||
reactionsEnabled, err := s.reactionsEnabled(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
return nil, err
|
||||
}
|
||||
if reactionsEnabled {
|
||||
reactions, err = s.Store.ListReactions(ctx, &store.FindReaction{
|
||||
ContentID: &request.Memo.Name,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
}
|
||||
}
|
||||
attachments, err := s.Store.ListAttachments(ctx, &store.FindAttachment{
|
||||
MemoID: &memo.ID,
|
||||
|
|
@ -501,11 +517,18 @@ func (s *APIV1Service) DeleteMemo(ctx context.Context, request *v1pb.DeleteMemoR
|
|||
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
|
||||
}
|
||||
|
||||
reactions, err := s.Store.ListReactions(ctx, &store.FindReaction{
|
||||
ContentID: &request.Name,
|
||||
})
|
||||
var reactions []*store.Reaction
|
||||
reactionsEnabled, err := s.reactionsEnabled(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
return nil, err
|
||||
}
|
||||
if reactionsEnabled {
|
||||
reactions, err = s.Store.ListReactions(ctx, &store.FindReaction{
|
||||
ContentID: &request.Name,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
}
|
||||
}
|
||||
|
||||
attachments, err := s.Store.ListAttachments(ctx, &store.FindAttachment{
|
||||
|
|
@ -669,14 +692,19 @@ func (s *APIV1Service) ListMemoComments(ctx context.Context, request *v1pb.ListM
|
|||
contentIDs = append(contentIDs, memoName)
|
||||
memoIDsForAttachments = append(memoIDsForAttachments, memo.ID)
|
||||
}
|
||||
reactions, err := s.Store.ListReactions(ctx, &store.FindReaction{ContentIDList: contentIDs})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
}
|
||||
|
||||
memoReactionsMap := make(map[string][]*store.Reaction)
|
||||
for _, reaction := range reactions {
|
||||
memoReactionsMap[reaction.ContentID] = append(memoReactionsMap[reaction.ContentID], reaction)
|
||||
reactionsEnabled, err := s.reactionsEnabled(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if reactionsEnabled {
|
||||
reactions, err := s.Store.ListReactions(ctx, &store.FindReaction{ContentIDList: contentIDs})
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to list reactions")
|
||||
}
|
||||
for _, reaction := range reactions {
|
||||
memoReactionsMap[reaction.ContentID] = append(memoReactionsMap[reaction.ContentID], reaction)
|
||||
}
|
||||
}
|
||||
|
||||
attachments, err := s.Store.ListAttachments(ctx, &store.FindAttachment{MemoIDList: memoIDsForAttachments})
|
||||
|
|
@ -715,6 +743,14 @@ func (s *APIV1Service) getContentLengthLimit(ctx context.Context) (int, error) {
|
|||
return int(instanceMemoRelatedSetting.ContentLengthLimit), nil
|
||||
}
|
||||
|
||||
func (s *APIV1Service) reactionsEnabled(ctx context.Context) (bool, error) {
|
||||
instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
|
||||
if err != nil {
|
||||
return false, status.Errorf(codes.Internal, "failed to get instance memo related setting")
|
||||
}
|
||||
return !instanceMemoRelatedSetting.DisableReactions, nil
|
||||
}
|
||||
|
||||
// DispatchMemoCreatedWebhook dispatches webhook when memo is created.
|
||||
func (s *APIV1Service) DispatchMemoCreatedWebhook(ctx context.Context, memo *v1pb.Memo) error {
|
||||
return s.dispatchMemoRelatedWebhook(ctx, memo, "memos.memo.created")
|
||||
|
|
|
|||
|
|
@ -15,6 +15,14 @@ import (
|
|||
)
|
||||
|
||||
func (s *APIV1Service) ListMemoReactions(ctx context.Context, request *v1pb.ListMemoReactionsRequest) (*v1pb.ListMemoReactionsResponse, error) {
|
||||
instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get instance memo related setting")
|
||||
}
|
||||
if instanceMemoRelatedSetting.DisableReactions {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "reactions are disabled")
|
||||
}
|
||||
|
||||
reactions, err := s.Store.ListReactions(ctx, &store.FindReaction{
|
||||
ContentID: &request.Name,
|
||||
})
|
||||
|
|
@ -33,6 +41,14 @@ func (s *APIV1Service) ListMemoReactions(ctx context.Context, request *v1pb.List
|
|||
}
|
||||
|
||||
func (s *APIV1Service) UpsertMemoReaction(ctx context.Context, request *v1pb.UpsertMemoReactionRequest) (*v1pb.Reaction, error) {
|
||||
instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get instance memo related setting")
|
||||
}
|
||||
if instanceMemoRelatedSetting.DisableReactions {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "reactions are disabled")
|
||||
}
|
||||
|
||||
user, err := s.fetchCurrentUser(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get current user")
|
||||
|
|
@ -55,6 +71,14 @@ func (s *APIV1Service) UpsertMemoReaction(ctx context.Context, request *v1pb.Ups
|
|||
}
|
||||
|
||||
func (s *APIV1Service) DeleteMemoReaction(ctx context.Context, request *v1pb.DeleteMemoReactionRequest) (*emptypb.Empty, error) {
|
||||
instanceMemoRelatedSetting, err := s.Store.GetInstanceMemoRelatedSetting(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get instance memo related setting")
|
||||
}
|
||||
if instanceMemoRelatedSetting.DisableReactions {
|
||||
return nil, status.Errorf(codes.PermissionDenied, "reactions are disabled")
|
||||
}
|
||||
|
||||
user, err := s.fetchCurrentUser(ctx)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ func (s *Store) GetInstanceMemoRelatedSetting(ctx context.Context) (*storepb.Ins
|
|||
if instanceMemoRelatedSetting.ContentLengthLimit < DefaultContentLengthLimit {
|
||||
instanceMemoRelatedSetting.ContentLengthLimit = DefaultContentLengthLimit
|
||||
}
|
||||
if len(instanceMemoRelatedSetting.Reactions) == 0 {
|
||||
if len(instanceMemoRelatedSetting.Reactions) == 0 && !instanceMemoRelatedSetting.DisableReactions {
|
||||
instanceMemoRelatedSetting.Reactions = append(instanceMemoRelatedSetting.Reactions, DefaultReactions...)
|
||||
}
|
||||
s.instanceSettingCache.Set(ctx, storepb.InstanceSettingKey_MEMO_RELATED.String(), &storepb.InstanceSetting{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { memo } from "react";
|
||||
import { useInstance } from "@/contexts/InstanceContext";
|
||||
import useCurrentUser from "@/hooks/useCurrentUser";
|
||||
import { State } from "@/types/proto/api/v1/common_pb";
|
||||
import type { Memo, Reaction } from "@/types/proto/api/v1/memo_service_pb";
|
||||
|
|
@ -13,10 +14,15 @@ interface Props {
|
|||
|
||||
const MemoReactionListView = (props: Props) => {
|
||||
const { memo: memoData, reactions } = props;
|
||||
const { memoRelatedSetting } = useInstance();
|
||||
const currentUser = useCurrentUser();
|
||||
const reactionGroup = useReactionGroups(reactions);
|
||||
const readonly = memoData.state === State.ARCHIVED;
|
||||
|
||||
if (memoRelatedSetting.disableReactions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (reactions.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ const ReactionSelector = (props: Props) => {
|
|||
const [open, setOpen] = useState(false);
|
||||
const { memoRelatedSetting } = useInstance();
|
||||
|
||||
if (memoRelatedSetting.disableReactions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const handleOpenChange = (newOpen: boolean) => {
|
||||
setOpen(newOpen);
|
||||
onOpenChange?.(newOpen);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ const MemoRelatedSettings = () => {
|
|||
};
|
||||
|
||||
const handleUpdateSetting = async () => {
|
||||
if (memoRelatedSetting.reactions.length === 0) {
|
||||
if (!memoRelatedSetting.disableReactions && memoRelatedSetting.reactions.length === 0) {
|
||||
toast.error("Reactions must not be empty.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -103,31 +103,42 @@ const MemoRelatedSettings = () => {
|
|||
</SettingGroup>
|
||||
|
||||
<SettingGroup title={t("setting.memo-related-settings.reactions")} showSeparator>
|
||||
<div className="w-full flex flex-row flex-wrap gap-2">
|
||||
{memoRelatedSetting.reactions.map((reactionType) => (
|
||||
<Badge key={reactionType} variant="outline" className="flex items-center gap-1.5 h-8 px-3">
|
||||
{reactionType}
|
||||
<span
|
||||
className="cursor-pointer text-muted-foreground hover:text-destructive"
|
||||
onClick={() => updatePartialSetting({ reactions: memoRelatedSetting.reactions.filter((r) => r !== reactionType) })}
|
||||
>
|
||||
<X className="w-3.5 h-3.5" />
|
||||
</span>
|
||||
</Badge>
|
||||
))}
|
||||
<div className="flex items-center gap-1.5">
|
||||
<Input
|
||||
className="w-32 h-8"
|
||||
placeholder={t("common.input")}
|
||||
value={editingReaction}
|
||||
onChange={(event) => setEditingReaction(event.target.value.trim())}
|
||||
onKeyDown={(e) => e.key === "Enter" && upsertReaction()}
|
||||
/>
|
||||
<Button variant="ghost" size="sm" onClick={upsertReaction} className="h-8 w-8 p-0">
|
||||
<CheckIcon className="w-4 h-4" />
|
||||
</Button>
|
||||
<SettingRow label={t("setting.memo-related-settings.disable-reactions")}>
|
||||
<Switch
|
||||
checked={memoRelatedSetting.disableReactions}
|
||||
onCheckedChange={(checked) => updatePartialSetting({ disableReactions: checked })}
|
||||
/>
|
||||
</SettingRow>
|
||||
|
||||
{!memoRelatedSetting.disableReactions ? (
|
||||
<div className="w-full flex flex-row flex-wrap gap-2">
|
||||
{memoRelatedSetting.reactions.map((reactionType) => (
|
||||
<Badge key={reactionType} variant="outline" className="flex items-center gap-1.5 h-8 px-3">
|
||||
{reactionType}
|
||||
<span
|
||||
className="cursor-pointer text-muted-foreground hover:text-destructive"
|
||||
onClick={() => updatePartialSetting({ reactions: memoRelatedSetting.reactions.filter((r) => r !== reactionType) })}
|
||||
>
|
||||
<X className="w-3.5 h-3.5" />
|
||||
</span>
|
||||
</Badge>
|
||||
))}
|
||||
<div className="flex items-center gap-1.5">
|
||||
<Input
|
||||
className="w-32 h-8"
|
||||
placeholder={t("common.input")}
|
||||
value={editingReaction}
|
||||
onChange={(event) => setEditingReaction(event.target.value.trim())}
|
||||
onKeyDown={(e) => e.key === "Enter" && upsertReaction()}
|
||||
/>
|
||||
<Button variant="ghost" size="sm" onClick={upsertReaction} className="h-8 w-8 p-0">
|
||||
<CheckIcon className="w-4 h-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-sm text-muted-foreground">{t("setting.memo-related-settings.reactions-disabled")}</p>
|
||||
)}
|
||||
</SettingGroup>
|
||||
|
||||
<div className="w-full flex justify-end">
|
||||
|
|
|
|||
|
|
@ -307,6 +307,8 @@
|
|||
"memo-related": "Memo",
|
||||
"memo-related-settings": {
|
||||
"content-lenght-limit": "Content length limit (Byte)",
|
||||
"disable-reactions": "Disable reactions",
|
||||
"reactions-disabled": "Reactions are disabled for this instance.",
|
||||
"enable-blur-nsfw-content": "Enable sensitive content (NSFW) blurring",
|
||||
"enable-memo-comments": "Enable memo comments",
|
||||
"enable-memo-location": "Enable memo location",
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import type { Message } from "@bufbuild/protobuf";
|
|||
* Describes the file api/v1/instance_service.proto.
|
||||
*/
|
||||
export const file_api_v1_instance_service: GenFile = /*@__PURE__*/
|
||||
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vL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask]);
|
||||
fileDesc("Ch1hcGkvdjEvaW5zdGFuY2Vfc2VydmljZS5wcm90bxIMbWVtb3MuYXBpLnYxIlsKD0luc3RhbmNlUHJvZmlsZRIPCgd2ZXJzaW9uGAIgASgJEgwKBGRlbW8YAyABKAgSFAoMaW5zdGFuY2VfdXJsGAYgASgJEhMKC2luaXRpYWxpemVkGAcgASgIIhsKGUdldEluc3RhbmNlUHJvZmlsZVJlcXVlc3QizgsKD0luc3RhbmNlU2V0dGluZxIRCgRuYW1lGAEgASgJQgPgQQgSRwoPZ2VuZXJhbF9zZXR0aW5nGAIgASgLMiwubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZy5HZW5lcmFsU2V0dGluZ0gAEkcKD3N0b3JhZ2Vfc2V0dGluZxgDIAEoCzIsLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuU3RvcmFnZVNldHRpbmdIABJQChRtZW1vX3JlbGF0ZWRfc2V0dGluZxgEIAEoCzIwLm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuTWVtb1JlbGF0ZWRTZXR0aW5nSAAahwMKDkdlbmVyYWxTZXR0aW5nEiIKGmRpc2FsbG93X3VzZXJfcmVnaXN0cmF0aW9uGAIgASgIEh4KFmRpc2FsbG93X3Bhc3N3b3JkX2F1dGgYAyABKAgSGQoRYWRkaXRpb25hbF9zY3JpcHQYBCABKAkSGAoQYWRkaXRpb25hbF9zdHlsZRgFIAEoCRJSCg5jdXN0b21fcHJvZmlsZRgGIAEoCzI6Lm1lbW9zLmFwaS52MS5JbnN0YW5jZVNldHRpbmcuR2VuZXJ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h0ubWVtb3MuYXBpLnYxLkluc3RhbmNlU2V0dGluZyJR2kETc2V0dGluZyx1cGRhdGVfbWFza4LT5JMCNToHc2V0dGluZzIqL2FwaS92MS97c2V0dGluZy5uYW1lPWluc3RhbmNlL3NldHRpbmdzLyp9QqwBChBjb20ubWVtb3MuYXBpLnYxQhRJbnN0YW5jZVNlcnZpY2VQcm90b1ABWjBnaXRodWIuY29tL3VzZW1lbW9zL21lbW9zL3Byb3RvL2dlbi9hcGkvdjE7YXBpdjGiAgNNQViqAgxNZW1vcy5BcGkuVjHKAgxNZW1vc1xBcGlcVjHiAhhNZW1vc1xBcGlcVjFcR1BCTWV0YWRhdGHqAg5NZW1vczo6QXBpOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_field_mask]);
|
||||
|
||||
/**
|
||||
* Instance profile message containing basic instance information.
|
||||
|
|
@ -384,6 +384,13 @@ export type InstanceSetting_MemoRelatedSetting = Message<"memos.api.v1.InstanceS
|
|||
*/
|
||||
enableDoubleClickEdit: boolean;
|
||||
|
||||
/**
|
||||
* disable_reactions disables memo reactions across the UI and API.
|
||||
*
|
||||
* @generated from field: bool disable_reactions = 8;
|
||||
*/
|
||||
disableReactions: boolean;
|
||||
|
||||
/**
|
||||
* reactions is the list of reactions.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue