Sort comments properly from Rophako ingest
This commit is contained in:
parent
c664c07a74
commit
ce4f0d2f7c
|
@ -169,6 +169,8 @@ func migrateComments() {
|
||||||
t = comments.New(id)
|
t = comments.New(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert the legacy comments into new-style ones.
|
||||||
|
var newComments []*comments.Comment
|
||||||
for commentID, legacy := range legacyThread {
|
for commentID, legacy := range legacyThread {
|
||||||
// Convert unix times to proper times.
|
// Convert unix times to proper times.
|
||||||
time := time.Unix(int64(legacy.Time), 0)
|
time := time.Unix(int64(legacy.Time), 0)
|
||||||
|
@ -185,13 +187,15 @@ func migrateComments() {
|
||||||
Updated: time,
|
Updated: time,
|
||||||
}
|
}
|
||||||
new.LoadAvatar() // in case it has none
|
new.LoadAvatar() // in case it has none
|
||||||
|
newComments = append(newComments, new)
|
||||||
log.Debug("Comment by %s on thread %s", new.Name, id)
|
|
||||||
t.Post(new)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-sort the comments by date.
|
// Re-sort the comments by date and post them in order.
|
||||||
sort.Sort(comments.ByCreated(t.Comments))
|
sort.Sort(comments.ByCreated(t.Comments))
|
||||||
|
for _, c := range newComments {
|
||||||
|
log.Debug("Comment by %s on thread %s", c.Name, id)
|
||||||
|
t.Post(c)
|
||||||
|
}
|
||||||
|
|
||||||
// Check for subscribers
|
// Check for subscribers
|
||||||
subs := legacySubscribers{}
|
subs := legacySubscribers{}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user