commit cab29ca7c492aefcefea1967b7fe37bdcd1db0fe
parent c8e07ddafbae9ad753bcf8253f4c80ade379ebbf
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sun, 29 Jan 2023 19:25:43 -0800
fix broken code
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pkg/database/tableLinks.go b/pkg/database/tableLinks.go
@@ -18,7 +18,7 @@ type Link struct {
Description string
Shorthand *string
SignedCertificate string
- OwnerUserID UserID
+ OwnerUserID *UserID
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -1493,6 +1493,7 @@ func NewLinkHandler(c echo.Context) error {
}
link, err := database.CreateLink(data.Link, data.Title, data.Description, data.Shorthand)
if err != nil {
+ logrus.Error(err)
data.ErrorLink = "failed to create link"
return c.Render(http.StatusOK, "new-link", data)
}
@@ -1713,7 +1714,7 @@ func ClaimLinkHandler(c echo.Context) error {
pemSign
link.SignedCertificate = signedCert
- link.OwnerUserID = authUser.ID
+ link.OwnerUserID = &authUser.ID
link.DoSave()
return c.Redirect(http.StatusFound, "/links/"+link.UUID)