diff --git a/pages/anime/anime.go b/pages/anime/anime.go index 7a90a338..a02aa89a 100644 --- a/pages/anime/anime.go +++ b/pages/anime/anime.go @@ -27,6 +27,13 @@ func Get(ctx *aero.Context) string { return ctx.Error(http.StatusNotFound, "Anime not found", err) } + // Anime list item + var animeListItem *arn.AnimeListItem + + if user != nil { + animeListItem = user.AnimeList().Find(anime.ID) + } + // Episodes episodes := anime.Episodes().Items @@ -61,6 +68,10 @@ func Get(ctx *aero.Context) string { } } + if animeListItem != nil { + episodeToFriends[animeListItem.Episodes] = append(episodeToFriends[animeListItem.Episodes], user) + } + arn.SortUsersLastSeenFirst(friends) } @@ -108,13 +119,6 @@ func Get(ctx *aero.Context) string { return len(amvs[i].Likes) > len(amvs[j].Likes) }) - // Anime list item - var animeListItem *arn.AnimeListItem - - if user != nil { - animeListItem = user.AnimeList().Find(anime.ID) - } - // Open Graph ctx.Data = getOpenGraph(ctx, anime) diff --git a/pages/anime/episodes.go b/pages/anime/episodes.go index 6044736f..5ed7e5f2 100644 --- a/pages/anime/episodes.go +++ b/pages/anime/episodes.go @@ -26,6 +26,12 @@ func Episodes(ctx *aero.Context) string { episodeToFriends[friendAnimeListItem.Episodes] = append(episodeToFriends[friendAnimeListItem.Episodes], friend) } } + + ownListItem := user.AnimeList().Find(anime.ID) + + if ownListItem != nil { + episodeToFriends[ownListItem.Episodes] = append(episodeToFriends[ownListItem.Episodes], user) + } } if err != nil {