Add tracks to user profile.

This commit is contained in:
Scott
2018-03-19 12:25:31 +01:00
parent 187a1c4f35
commit a317a1f29b
7 changed files with 141 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package profilequotes
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
)
// Liked shows all quotes liked by a particular user.
func Liked(ctx *aero.Context) string {
return render(ctx, likedQuotes)
}
// likedQuotes returns all quotes that the user with the given user ID liked.
func likedQuotes(userID string) []*arn.Quote {
return arn.FilterQuotes(func(track *arn.Quote) bool {
return !track.IsDraft && len(track.Text.English) > 0 && track.LikedBy(userID)
})
}