Upgraded to latest aero version
This commit is contained in:
@ -12,7 +12,7 @@ import (
|
||||
const maxAllNotifications = 150
|
||||
|
||||
// All shows all notifications.
|
||||
func All(ctx *aero.Context) string {
|
||||
func All(ctx aero.Context) error {
|
||||
notifications, err := arn.AllNotifications()
|
||||
|
||||
if err != nil {
|
||||
|
@ -7,11 +7,12 @@ import (
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// CountUnseen sends the number of unseen notifications.
|
||||
func CountUnseen(ctx *aero.Context) string {
|
||||
func CountUnseen(ctx aero.Context) error {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil {
|
||||
@ -24,7 +25,7 @@ func CountUnseen(ctx *aero.Context) string {
|
||||
}
|
||||
|
||||
// MarkNotificationsAsSeen marks all notifications as seen.
|
||||
func MarkNotificationsAsSeen(ctx *aero.Context) string {
|
||||
func MarkNotificationsAsSeen(ctx aero.Context) error {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil {
|
||||
@ -44,11 +45,11 @@ func MarkNotificationsAsSeen(ctx *aero.Context) string {
|
||||
Data: 0,
|
||||
})
|
||||
|
||||
return "ok"
|
||||
return nil
|
||||
}
|
||||
|
||||
// Latest returns the latest notifications.
|
||||
func Latest(ctx *aero.Context) string {
|
||||
func Latest(ctx aero.Context) error {
|
||||
userID := ctx.Get("id")
|
||||
user, err := arn.GetUser(userID)
|
||||
|
||||
@ -71,7 +72,7 @@ func Latest(ctx *aero.Context) string {
|
||||
}
|
||||
|
||||
// Test sends a test notification to the logged in user.
|
||||
func Test(ctx *aero.Context) string {
|
||||
func Test(ctx aero.Context) error {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil {
|
||||
@ -81,9 +82,9 @@ func Test(ctx *aero.Context) string {
|
||||
user.SendNotification(&arn.PushNotification{
|
||||
Title: "Anime Notifier",
|
||||
Message: "Yay, it works!",
|
||||
Icon: "https://" + ctx.App.Config.Domain + "/images/brand/220.png",
|
||||
Icon: "https://" + assets.Domain + "/images/brand/220.png",
|
||||
Type: arn.NotificationTypeTest,
|
||||
})
|
||||
|
||||
return "ok"
|
||||
return nil
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
const maxNotifications = 30
|
||||
|
||||
// ByUser shows all notifications sent to the given user.
|
||||
func ByUser(ctx *aero.Context) string {
|
||||
func ByUser(ctx aero.Context) error {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil {
|
||||
|
Reference in New Issue
Block a user