Skip to content

Commit

Permalink
chore: release v0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed Sep 9, 2022
1 parent d1a4348 commit b8a7df2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
10 changes: 8 additions & 2 deletions common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (

// Version is the service current released version.
// Semantic versioning: https://semver.org/
var Version = "0.4.2"
var Version = "0.4.3"

// DevVersion is the service current development version.
var DevVersion = "0.4.2"
var DevVersion = "0.4.3"

func GetCurrentVersion(mode string) string {
if mode == "dev" {
Expand All @@ -27,6 +27,12 @@ func GetMinorVersion(version string) string {
return versionList[0] + "." + versionList[1]
}

func GetSchemaVersion(version string) string {
minorVersion := GetMinorVersion(version)

return minorVersion + ".0"
}

// convSemanticVersionToInt converts version string to int.
func convSemanticVersionToInt(version string) int {
versionList := strings.Split(version, ".")
Expand Down
4 changes: 2 additions & 2 deletions server/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
OpenID: &openID,
}
user, err := s.Store.FindUser(ctx, userFind)
if err != nil {
if err != nil && common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find user by open_id").SetInternal(err)
}
if user != nil {
Expand All @@ -90,7 +90,7 @@ func aclMiddleware(s *Server, next echo.HandlerFunc) echo.HandlerFunc {
ID: &userID,
}
user, err := s.Store.FindUser(ctx, userFind)
if err != nil {
if err != nil && common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find user by ID: %d", userID)).SetInternal(err)
}
if user != nil {
Expand Down
4 changes: 2 additions & 2 deletions server/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
Email: &signin.Email,
}
user, err := s.Store.FindUser(ctx, userFind)
if err != nil {
if err != nil && common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find user by email %s", signin.Email)).SetInternal(err)
}
if user == nil {
Expand Down Expand Up @@ -68,7 +68,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
Role: &hostUserType,
}
hostUser, err := s.Store.FindUser(ctx, &hostUserFind)
if err != nil {
if err != nil && common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find host user").SetInternal(err)
}
if hostUser != nil {
Expand Down
3 changes: 2 additions & 1 deletion server/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net/http"

"github.com/usememos/memos/api"
"github.com/usememos/memos/common"

"github.com/labstack/echo/v4"
)
Expand All @@ -27,7 +28,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
Role: &hostUserType,
}
hostUser, err := s.Store.FindUser(ctx, &hostUserFind)
if err != nil {
if err != nil && common.ErrorCode(err) != common.NotFound {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find host user").SetInternal(err)
}

Expand Down
2 changes: 1 addition & 1 deletion store/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (db *DB) Open(ctx context.Context) (err error) {
}
}

if common.IsVersionGreaterThan(currentVersion, migrationHistory.Version) {
if common.IsVersionGreaterThan(common.GetSchemaVersion(currentVersion), migrationHistory.Version) {
minorVersionList := getMinorVersionList()

// backup the raw database file before migration
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "memos",
"version": "0.4.2",
"version": "0.4.3",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand Down

0 comments on commit b8a7df2

Please sign in to comment.