Improved user references reset patch

This commit is contained in:
Eduard Urbach 2018-11-09 03:41:54 +09:00
parent 1ae8547721
commit 94d8104925
3 changed files with 14 additions and 3 deletions

View File

@ -51,7 +51,7 @@ func Get(ctx *aero.Context) string {
}
}
arn.SortUsersLastSeen(friends)
arn.SortUsersLastSeenFirst(friends)
}
// Sort relations by start date

View File

@ -19,7 +19,7 @@ func GetFollowers(ctx *aero.Context) string {
}
followers := viewUser.Followers()
arn.SortUsersLastSeen(followers)
arn.SortUsersLastSeenFirst(followers)
return ctx.HTML(components.ProfileFollowers(followers, viewUser, utils.GetUser(ctx), ctx.URI()))

View File

@ -17,7 +17,16 @@ func main() {
// Iterate over the stream
count := 0
for user := range arn.StreamUsers() {
users, err := arn.AllUsers()
arn.PanicOnError(err)
// Make the most recently seen users overwrite the references of older accounts.
// Some people accidentally created 2 accounts and in case of overlaps we want
// to keep the references for the account that is more likely used.
arn.SortUsersLastSeenLast(users)
// Write new references
for _, user := range users {
count++
println(count, user.Nick)
@ -34,6 +43,8 @@ func main() {
if user.Accounts.Facebook.ID != "" {
user.ConnectFacebook(user.Accounts.Facebook.ID)
}
user.Save()
}
color.Green("Finished.")