🐛 Fix set banner after avatar reset avatar settings

This commit is contained in:
LittleSheep 2024-05-22 22:51:30 +08:00
parent a502f11ebc
commit 31139e943f
2 changed files with 7 additions and 1 deletions

View File

@ -3,10 +3,12 @@ package server
import ( import (
"context" "context"
"fmt" "fmt"
pcpb "git.solsynth.dev/hydrogen/paperclip/pkg/grpc/proto" pcpb "git.solsynth.dev/hydrogen/paperclip/pkg/grpc/proto"
"git.solsynth.dev/hydrogen/passport/pkg/database" "git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/grpc" "git.solsynth.dev/hydrogen/passport/pkg/grpc"
"git.solsynth.dev/hydrogen/passport/pkg/models" "git.solsynth.dev/hydrogen/passport/pkg/models"
"git.solsynth.dev/hydrogen/passport/pkg/services"
"git.solsynth.dev/hydrogen/passport/pkg/utils" "git.solsynth.dev/hydrogen/passport/pkg/utils"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/samber/lo" "github.com/samber/lo"
@ -34,6 +36,8 @@ func setAvatar(c *fiber.Ctx) error {
if err := database.C.Save(&user).Error; err != nil { if err := database.C.Save(&user).Error; err != nil {
return fiber.NewError(fiber.StatusInternalServerError, err.Error()) return fiber.NewError(fiber.StatusInternalServerError, err.Error())
} else {
services.InvalidAuthCacheWithUser(user.ID)
} }
return c.SendStatus(fiber.StatusOK) return c.SendStatus(fiber.StatusOK)
@ -61,6 +65,8 @@ func setBanner(c *fiber.Ctx) error {
if err := database.C.Save(&user).Error; err != nil { if err := database.C.Save(&user).Error; err != nil {
return fiber.NewError(fiber.StatusInternalServerError, err.Error()) return fiber.NewError(fiber.StatusInternalServerError, err.Error())
} else {
services.InvalidAuthCacheWithUser(user.ID)
} }
return c.SendStatus(fiber.StatusOK) return c.SendStatus(fiber.StatusOK)