Fixed unused parameters
This commit is contained in:
parent
8b583d46b9
commit
1c0dc14317
@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
@ -121,6 +120,6 @@ func testRoute(t *testing.T, app *aero.Application, route string) {
|
||||
case http.StatusOK, http.StatusTemporaryRedirect, http.StatusPermanentRedirect:
|
||||
// OK
|
||||
default:
|
||||
panic(fmt.Errorf("%s | Wrong status code | %v instead of %v", route, status, http.StatusOK))
|
||||
t.Fatalf("%s | Wrong status code | %v instead of %v", route, status, http.StatusOK)
|
||||
}
|
||||
}
|
||||
|
@ -123,12 +123,12 @@ func Get(ctx aero.Context) error {
|
||||
|
||||
// Open Graph
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, anime)
|
||||
customCtx.OpenGraph = getOpenGraph(anime)
|
||||
|
||||
return ctx.HTML(components.Anime(anime, animeListItem, tracks, amvs, amvAppearances, episodes, friends, friendsAnimeListItems, episodeToFriends, user))
|
||||
}
|
||||
|
||||
func getOpenGraph(ctx aero.Context, anime *arn.Anime) *arn.OpenGraph {
|
||||
func getOpenGraph(anime *arn.Anime) *arn.OpenGraph {
|
||||
description := anime.Summary
|
||||
|
||||
if len(description) > maxDescriptionLength {
|
||||
|
@ -20,7 +20,7 @@ func editorList(ctx aero.Context, title string, filter func(*arn.SoundTrack) boo
|
||||
return ctx.Error(http.StatusUnauthorized, "Not authorized")
|
||||
}
|
||||
|
||||
tracks, count := filterSoundTracks(ctx, user, filter)
|
||||
tracks, count := filterSoundTracks(filter)
|
||||
url := strings.TrimPrefix(ctx.Path(), "/_")
|
||||
|
||||
return ctx.HTML(components.SoundTracksEditorListFull(
|
||||
@ -34,7 +34,7 @@ func editorList(ctx aero.Context, title string, filter func(*arn.SoundTrack) boo
|
||||
}
|
||||
|
||||
// filterSoundTracks filters soundtracks by the given filter function.
|
||||
func filterSoundTracks(ctx aero.Context, user *arn.User, filter func(*arn.SoundTrack) bool) ([]*arn.SoundTrack, int) {
|
||||
func filterSoundTracks(filter func(*arn.SoundTrack) bool) ([]*arn.SoundTrack, int) {
|
||||
// Filter
|
||||
tracks := arn.FilterSoundTracks(func(track *arn.SoundTrack) bool {
|
||||
return !track.IsDraft && filter(track)
|
||||
|
@ -27,6 +27,6 @@ func Feed(ctx aero.Context) error {
|
||||
}
|
||||
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, group)
|
||||
customCtx.OpenGraph = getOpenGraph(group)
|
||||
return ctx.HTML(components.GroupFeed(group, member, user))
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ func Info(ctx aero.Context) error {
|
||||
}
|
||||
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, group)
|
||||
customCtx.OpenGraph = getOpenGraph(group)
|
||||
return ctx.HTML(components.GroupInfo(group, member, user))
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ func Members(ctx aero.Context) error {
|
||||
}
|
||||
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, group)
|
||||
customCtx.OpenGraph = getOpenGraph(group)
|
||||
return ctx.HTML(components.GroupMembers(group, member, user))
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
)
|
||||
|
||||
func getOpenGraph(ctx aero.Context, group *arn.Group) *arn.OpenGraph {
|
||||
func getOpenGraph(group *arn.Group) *arn.OpenGraph {
|
||||
return &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": group.Name,
|
||||
|
@ -1,13 +1,12 @@
|
||||
package post
|
||||
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
func getOpenGraph(ctx aero.Context, post *arn.Post) *arn.OpenGraph {
|
||||
func getOpenGraph(post *arn.Post) *arn.OpenGraph {
|
||||
openGraph := &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": post.TitleByUser(nil),
|
||||
|
@ -21,6 +21,6 @@ func Get(ctx aero.Context) error {
|
||||
}
|
||||
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, post)
|
||||
customCtx.OpenGraph = getOpenGraph(post)
|
||||
return ctx.HTML(components.Post(post, user))
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ func Lyrics(ctx aero.Context) error {
|
||||
return ctx.Error(http.StatusNotFound, "Track not found", err)
|
||||
}
|
||||
|
||||
openGraph := getOpenGraph(ctx, track)
|
||||
openGraph := getOpenGraph(track)
|
||||
|
||||
if track.Lyrics.Native != "" {
|
||||
openGraph.Tags["og:description"] = utils.CutLongDescription(track.Lyrics.Native)
|
||||
|
@ -3,12 +3,11 @@ package soundtrack
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
)
|
||||
|
||||
func getOpenGraph(ctx aero.Context, track *arn.SoundTrack) *arn.OpenGraph {
|
||||
func getOpenGraph(track *arn.SoundTrack) *arn.OpenGraph {
|
||||
openGraph := &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": track.Title.ByUser(nil),
|
||||
|
@ -21,6 +21,6 @@ func Get(ctx aero.Context) error {
|
||||
}
|
||||
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, track)
|
||||
customCtx.OpenGraph = getOpenGraph(track)
|
||||
return ctx.HTML(components.SoundTrackPage(track, user))
|
||||
}
|
||||
|
@ -1,13 +1,12 @@
|
||||
package thread
|
||||
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
func getOpenGraph(ctx aero.Context, thread *arn.Thread) *arn.OpenGraph {
|
||||
func getOpenGraph(thread *arn.Thread) *arn.OpenGraph {
|
||||
openGraph := &arn.OpenGraph{
|
||||
Tags: map[string]string{
|
||||
"og:title": thread.Title,
|
||||
|
@ -23,6 +23,6 @@ func Get(ctx aero.Context) error {
|
||||
}
|
||||
|
||||
customCtx := ctx.(*middleware.OpenGraphContext)
|
||||
customCtx.OpenGraph = getOpenGraph(ctx, thread)
|
||||
customCtx.OpenGraph = getOpenGraph(thread)
|
||||
return ctx.HTML(components.Thread(thread, user))
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ func RenderField(b *strings.Builder, v *reflect.Value, field reflect.StructField
|
||||
|
||||
// Any kind of array
|
||||
if strings.HasPrefix(fieldType, "[]") {
|
||||
renderSliceField(b, v, field, idPrefix, fieldType, fieldValue)
|
||||
renderSliceField(b, field, idPrefix, fieldType, fieldValue)
|
||||
return
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ func renderStringField(b *strings.Builder, v *reflect.Value, field reflect.Struc
|
||||
}
|
||||
|
||||
// Slice field
|
||||
func renderSliceField(b *strings.Builder, v *reflect.Value, field reflect.StructField, idPrefix string, fieldType string, fieldValue reflect.Value) {
|
||||
func renderSliceField(b *strings.Builder, field reflect.StructField, idPrefix string, fieldType string, fieldValue reflect.Value) {
|
||||
b.WriteString(`<div class="widget-section">`)
|
||||
b.WriteString(`<h3 class="widget-title">`)
|
||||
b.WriteString(field.Name)
|
||||
|
Loading…
Reference in New Issue
Block a user