Fixed missing input check
This commit is contained in:
parent
1ef1c55e49
commit
a12b749ee9
25
patches/notification-delete-old/notification-delete-old.go
Normal file
25
patches/notification-delete-old/notification-delete-old.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/animenotifier/arn"
|
||||||
|
"github.com/fatih/color"
|
||||||
|
)
|
||||||
|
|
||||||
|
const maxNotificationsPerUser = 80
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
color.Yellow("Deleting old notifications")
|
||||||
|
|
||||||
|
defer color.Green("Finished")
|
||||||
|
defer arn.Node.Close()
|
||||||
|
|
||||||
|
for user := range arn.StreamUsers() {
|
||||||
|
notificationCount := len(user.Notifications().Items)
|
||||||
|
|
||||||
|
if notificationCount > maxNotificationsPerUser {
|
||||||
|
fmt.Println(user.Nick, notificationCount)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -175,7 +175,10 @@ export default class AnimeNotifier {
|
|||||||
// Auto-focus first input element on welcome page.
|
// Auto-focus first input element on welcome page.
|
||||||
if(location.pathname === "/welcome") {
|
if(location.pathname === "/welcome") {
|
||||||
let firstInput = this.app.content.getElementsByTagName("input")[0] as HTMLInputElement
|
let firstInput = this.app.content.getElementsByTagName("input")[0] as HTMLInputElement
|
||||||
firstInput.focus()
|
|
||||||
|
if(firstInput) {
|
||||||
|
firstInput.focus()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user