🐛 Fix set banner after avatar reset avatar settings
This commit is contained in:
parent
a502f11ebc
commit
31139e943f
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user