add disqus prefix for importer

This commit is contained in:
Umputun
2018-02-05 16:59:58 -06:00
parent 7bf0f6864e
commit d65c51b22a
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -118,13 +118,13 @@ func (d *Disqus) convert(r io.Reader, siteID string) (ch chan store.Comment) {
c := store.Comment{
ID: comment.UID,
Locator: store.Locator{URL: postsMap[comment.Tid.Val], SiteID: siteID},
User: store.User{ID: comment.AuthorUserName, Name: comment.AuthorName, IP: comment.IP},
User: store.User{ID: "disqus-" + comment.AuthorUserName, Name: comment.AuthorName, IP: comment.IP},
Text: d.cleanText(comment.Message),
Timestamp: comment.CreatedAt,
ParentID: comment.Pid.Val,
}
if c.User.ID == "" {
c.User.ID = "import_" + c.User.Name
if c.User.ID == "disqus-" {
c.User.ID = "disqus-" + c.User.Name
}
if c.ID == "" {
c.ID = comment.ID
+1 -1
View File
@@ -52,7 +52,7 @@ func TestDisqus_Convert(t *testing.T) {
Text: `<p>The quick brown fox jumps over the lazy dog.</p><p><a href="https://https://radio-t.com" rel="nofollow noopener" title="radio-t">some link</a></p>`,
User: store.User{
Name: "Alexander Blah",
ID: "facebook-1787732238",
ID: "disqus-facebook-1787732238",
IP: "178.178.178.178",
},
}