Deleted utils.GetUser

This commit is contained in:
2019-11-17 16:59:34 +09:00
parent ad9870b1c1
commit daed4146ed
117 changed files with 178 additions and 271 deletions

View File

@ -1,28 +0,0 @@
package utils
import (
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/arn"
)
// GetUser returns the logged in user for the given context.
func GetUser(ctx aero.Context) *arn.User {
return arn.GetUserFromContext(ctx)
}
// SameUser returns "true" or "false" depending on if the users are the same.
func SameUser(a *arn.User, b *arn.User) string {
if a == nil {
return "false"
}
if b == nil {
return "false"
}
if a.ID == b.ID {
return "true"
}
return "false"
}

View File

@ -5,14 +5,13 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/arn"
"github.com/animenotifier/notify.moe/utils"
)
// Handler returns a function that renders the history of any object.
func Handler(render func(interface{}, []*arn.EditLogEntry, *arn.User) string, typeNames ...string) func(ctx aero.Context) error {
return func(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
obj, err := arn.DB.Get(typeNames[0], id)
if err != nil {