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.

fix: create memo with resource name

Steven40bd75c72513
diff --git a/api/v1/memo.go b/api/v1/memo.go
index 59b01cc8b..1aa502ae0 100644
--- a/api/v1/memo.go
+++ b/api/v1/memo.go
@@ -9,6 +9,7 @@ import (
"time"
"github.com/labstack/echo/v4"
+ "github.com/lithammer/shortuuid/v4"
"github.com/pkg/errors"
"go.uber.org/zap"
@@ -894,10 +895,11 @@ func convertCreateMemoRequestToMemoMessage(memoCreate *CreateMemoRequest) *store
createdTs = *memoCreate.CreatedTs
}
return &store.Memo{
- CreatorID: memoCreate.CreatorID,
- CreatedTs: createdTs,
- Content: memoCreate.Content,
- Visibility: store.Visibility(memoCreate.Visibility),
+ ResourceName: shortuuid.New(),
+ CreatorID: memoCreate.CreatorID,
+ CreatedTs: createdTs,
+ Content: memoCreate.Content,
+ Visibility: store.Visibility(memoCreate.Visibility),
}
}
diff --git a/server/integration/telegram.go b/server/integration/telegram.go
index b7ee93908..5908e14f7 100644
--- a/server/integration/telegram.go
+++ b/server/integration/telegram.go
@@ -8,6 +8,7 @@ import (
"strconv"
"unicode/utf16"
+ "github.com/lithammer/shortuuid/v4"
"github.com/pkg/errors"
apiv1 "github.com/usememos/memos/api/v1"
@@ -58,8 +59,9 @@ func (t *TelegramHandler) MessageHandle(ctx context.Context, bot *telegram.Bot,
}
create := &store.Memo{
- CreatorID: creatorID,
- Visibility: store.Private,
+ ResourceName: shortuuid.New(),
+ CreatorID: creatorID,
+ Visibility: store.Private,
}
if message.Text != nil {