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

@ -9,7 +9,6 @@ import (
"github.com/animenotifier/notify.moe/assets"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/middleware"
"github.com/animenotifier/notify.moe/utils"
)
const (
@ -22,7 +21,7 @@ const (
// Get anime page.
func Get(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
anime, err := arn.GetAnime(id)
if err != nil {

View File

@ -3,8 +3,6 @@ package anime
import (
"net/http"
"github.com/animenotifier/notify.moe/utils"
"github.com/animenotifier/notify.moe/components"
"github.com/aerogo/aero"
@ -14,7 +12,7 @@ import (
// Characters ...
func Characters(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
anime, err := arn.GetAnime(id)
if err != nil {

View File

@ -4,7 +4,6 @@ import (
"net/http"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/arn"
@ -12,7 +11,7 @@ import (
// Comments ...
func Comments(ctx aero.Context) error {
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
id := ctx.Get("id")
anime, err := arn.GetAnime(id)

View File

@ -6,14 +6,13 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
"github.com/animenotifier/notify.moe/utils/editform"
)
// Main anime edit page.
func Main(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
if user == nil || (user.Role != "editor" && user.Role != "admin") {
return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this anime")
@ -31,7 +30,7 @@ func Main(ctx aero.Context) error {
// Images anime images edit page.
func Images(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
if user == nil || (user.Role != "editor" && user.Role != "admin") {
return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit this anime")
@ -49,7 +48,7 @@ func Images(ctx aero.Context) error {
// Characters anime characters edit page.
func Characters(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
if user == nil || (user.Role != "editor" && user.Role != "admin") {
return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit")
@ -73,7 +72,7 @@ func Characters(ctx aero.Context) error {
// Relations anime relations edit page.
func Relations(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
if user == nil || (user.Role != "editor" && user.Role != "admin") {
return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit")
@ -97,7 +96,7 @@ func Relations(ctx aero.Context) error {
// Episodes anime episodes edit page.
func Episodes(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
if user == nil || (user.Role != "editor" && user.Role != "admin") {
return ctx.Error(http.StatusUnauthorized, "Not logged in or not auhorized to edit")

View File

@ -4,7 +4,6 @@ import (
"net/http"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/arn"
@ -12,7 +11,7 @@ import (
// Episodes ...
func Episodes(ctx aero.Context) error {
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
id := ctx.Get("id")
anime, err := arn.GetAnime(id)
episodeToFriends := map[int][]*arn.User{}

View File

@ -6,12 +6,11 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Relations ...
func Relations(ctx aero.Context) error {
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
id := ctx.Get("id")
anime, err := arn.GetAnime(id)

View File

@ -3,8 +3,6 @@ package anime
import (
"net/http"
"github.com/animenotifier/notify.moe/utils"
"github.com/animenotifier/notify.moe/components"
"github.com/aerogo/aero"
@ -14,7 +12,7 @@ import (
// Tracks ...
func Tracks(ctx aero.Context) error {
id := ctx.Get("id")
user := utils.GetUser(ctx)
user := arn.GetUserFromContext(ctx)
anime, err := arn.GetAnime(id)