Almost finished with old notification deletion
This commit is contained in:
parent
256632e817
commit
b8c9f9e9eb
34
patches/delete-old-notifications/delete-old-notifications.go
Normal file
34
patches/delete-old-notifications/delete-old-notifications.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/animenotifier/arn"
|
||||||
|
"github.com/fatih/color"
|
||||||
|
)
|
||||||
|
|
||||||
|
const month = 30 * 24 * time.Hour
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
color.Yellow("Deleting private user data")
|
||||||
|
|
||||||
|
defer arn.Node.Close()
|
||||||
|
defer color.Green("Finished.")
|
||||||
|
|
||||||
|
for user := range arn.StreamUsers() {
|
||||||
|
color.Cyan(user.Nick)
|
||||||
|
|
||||||
|
for _, notification := range user.Notifications().Notifications() {
|
||||||
|
if time.Since(notification.CreatedTime()) < 2*month {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(notification)
|
||||||
|
// notification.Delete()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save in DB
|
||||||
|
// user.Save()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user