Added patch to fix user websites
This commit is contained in:
parent
9c68ecb4bb
commit
7d70f3b0b5
29
patches/fix-user-websites/fix-user-websites.go
Normal file
29
patches/fix-user-websites/fix-user-websites.go
Normal file
@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/arn/autocorrect"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func main() {
|
||||
color.Yellow("Updating user references")
|
||||
defer arn.Node.Close()
|
||||
|
||||
count := 0
|
||||
|
||||
for user := range arn.StreamUsers() {
|
||||
old := user.Website
|
||||
user.Website = autocorrect.Website(user.Website)
|
||||
|
||||
if user.Website != old {
|
||||
fmt.Println(color.YellowString(old), "->", color.YellowString(user.Website))
|
||||
count++
|
||||
user.Save()
|
||||
}
|
||||
}
|
||||
|
||||
color.Green("%d links have been corrected.", count)
|
||||
}
|
Loading…
Reference in New Issue
Block a user