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
chore: tweak variable names
Stevend8a052813516
diff --git a/api/v1/memo.go b/api/v1/memo.goindex f107924d5..d741d36bf 100644--- a/api/v1/memo.go+++ b/api/v1/memo.go@@ -435,34 +435,34 @@ func (s *APIV1Service) CreateMemo(c echo.Context) error {// - creatorUsername is listed at ./web/src/helpers/api.ts:82, but it's not present herefunc (s *APIV1Service) GetAllMemos(c echo.Context) error {ctx := c.Request().Context()- findMemoMessage := &store.FindMemo{}+ memoFind := &store.FindMemo{}_, ok := c.Get(userIDContextKey).(int32)if !ok {- findMemoMessage.VisibilityList = []store.Visibility{store.Public}+ memoFind.VisibilityList = []store.Visibility{store.Public}} else {- findMemoMessage.VisibilityList = []store.Visibility{store.Public, store.Protected}+ memoFind.VisibilityList = []store.Visibility{store.Public, store.Protected}}if limit, err := strconv.Atoi(c.QueryParam("limit")); err == nil {- findMemoMessage.Limit = &limit+ memoFind.Limit = &limit}if offset, err := strconv.Atoi(c.QueryParam("offset")); err == nil {- findMemoMessage.Offset = &offset+ memoFind.Offset = &offset}// Only fetch normal status memos.normalStatus := store.Normal- findMemoMessage.RowStatus = &normalStatus+ memoFind.RowStatus = &normalStatusmemoDisplayWithUpdatedTs, err := s.getMemoDisplayWithUpdatedTsSettingValue(ctx)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to get memo display with updated ts setting value").SetInternal(err)}if memoDisplayWithUpdatedTs {- findMemoMessage.OrderByUpdatedTs = true+ memoFind.OrderByUpdatedTs = true}- list, err := s.Store.ListMemos(ctx, findMemoMessage)+ list, err := s.Store.ListMemos(ctx, memoFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch all memo list").SetInternal(err)}diff --git a/api/v1/user.go b/api/v1/user.goindex 4b5344a4f..d9b863bed 100644--- a/api/v1/user.go+++ b/api/v1/user.go@@ -313,10 +313,9 @@ func (s *APIV1Service) DeleteUser(c echo.Context) error {return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("id"))).SetInternal(err)}- userDelete := &store.DeleteUser{+ if err := s.Store.DeleteUser(ctx, &store.DeleteUser{ID: userID,- }- if err := s.Store.DeleteUser(ctx, userDelete); err != nil {+ }); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to delete user").SetInternal(err)}return c.JSON(http.StatusOK, true)diff --git a/store/db/mysql/memo.go b/store/db/mysql/memo.goindex 3b4a77dcf..095967406 100644--- a/store/db/mysql/memo.go+++ b/store/db/mysql/memo.go@@ -64,12 +64,12 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo}}if v := find.VisibilityList; len(v) != 0 {- list := []string{}+ placeholder := []string{}for _, visibility := range v {- list = append(list, "?")- args = append(args, visibility)+ placeholder = append(placeholder, "?")+ args = append(args, visibility.String())}- where = append(where, fmt.Sprintf("`memo`.`visibility` in (%s)", strings.Join(list, ",")))+ where = append(where, fmt.Sprintf("`memo`.`visibility` in (%s)", strings.Join(placeholder, ",")))}orders := []string{}if find.OrderByPinned {diff --git a/store/db/sqlite/memo.go b/store/db/sqlite/memo.goindex ef6826465..0f1117d29 100644--- a/store/db/sqlite/memo.go+++ b/store/db/sqlite/memo.go@@ -51,12 +51,12 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo}}if v := find.VisibilityList; len(v) != 0 {- list := []string{}+ placeholder := []string{}for _, visibility := range v {- list = append(list, fmt.Sprintf("$%d", len(args)+1))- args = append(args, visibility)+ placeholder = append(placeholder, "?")+ args = append(args, visibility.String())}- where = append(where, fmt.Sprintf("memo.visibility in (%s)", strings.Join(list, ",")))+ where = append(where, fmt.Sprintf("memo.visibility in (%s)", strings.Join(placeholder, ",")))}if v := find.Pinned; v != nil {where = append(where, "memo_organizer.pinned = 1")