chore: support deleting storage (#1095)

This commit is contained in:
boojack
2023-02-15 22:54:46 +08:00
committed by GitHub
parent e46f77681d
commit 7e8011ba34
11 changed files with 87 additions and 56 deletions

View File

@@ -54,20 +54,19 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
}
// Find system settings
disablePublicMemosSystemSettingKey := api.SystemSettingDisablePublicMemosName
disablePublicMemosSystemSetting, err := s.Store.FindSystemSetting(ctx, &api.SystemSettingFind{
Name: &disablePublicMemosSystemSettingKey,
Name: api.SystemSettingDisablePublicMemosName,
})
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find system setting").SetInternal(err)
}
if disablePublicMemosSystemSetting != nil {
disablePublicMemosValue := false
err = json.Unmarshal([]byte(disablePublicMemosSystemSetting.Value), &disablePublicMemosValue)
disablePublicMemos := false
err = json.Unmarshal([]byte(disablePublicMemosSystemSetting.Value), &disablePublicMemos)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to unmarshal system setting").SetInternal(err)
}
if disablePublicMemosValue {
if disablePublicMemos {
memoCreate.Visibility = api.Private
}
}