Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importing of comments from Wordpress fails when there is a "Pages menu" #24

Open
Krastanov opened this issue Mar 12, 2013 · 5 comments
Open

Comments

@Krastanov
Copy link

On trying to import I get the following error page:

The change you wanted was rejected.

Maybe you tried to change something you didn't have access to.

The console reports this:

Started POST "/admin/comments/import" for 140.***.***.*** at 2013-03-12 19:47:14 +0000
  Processing by Admin::CommentsController#import as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"54eY6xe8t1gZUhyKCeH9IQ81aPetyjwieLmau2EeYXU=", "site_id"=>"1", "import_type"=>"Word Press", "database_host"=>"localhost", "database_name"=>"wordpress", "database_user"=>"root", "database_password"=>"[FILTERED]", "commit"=>"Import"}
Completed 422 Unprocessable Entity in 119ms

ActiveRecord::RecordInvalid (Validation failed: Title can't be blank):
  app/models/topic.rb:31:in `lookup_or_create'
  lib/juvia/migrators/word_press.rb:140:in `process_post'
  lib/juvia/migrators/word_press.rb:120:in `block in process'
  lib/juvia/migrators/word_press.rb:119:in `process'
  lib/juvia/migrators.rb:13:in `process'
  app/controllers/admin/comments_controller.rb:68:in `import'

cache: [POST /admin/comments/import] invalidate, pass

The first 11 comments are nonetheless successfully imported. I trashed them in wordpress and tried again. The same failure, and no new comments transfered. Then I trashed the rest of the comments one by one in wordpress. The same failure. Even when I have no more comments in wordpress (i.e. all of them are in the trash folder) I get the same error.

I can provide a wordpress xml dump for testing.

Any suggestions?

EDIT: see below for a workaround.

@JangoSteve
Copy link
Collaborator

It sounds like you're trying to import a comment for a post which doesn't have a title, which is invalid in Juvia (and I'm not sure how it's valid in WordPress).

@Krastanov
Copy link
Author

I suspected something like this, so I removed all drafts without titles (only drafts were like this and they did not contain any comments obviously), however it continues to fail in the same way with the same error message.

@Krastanov
Copy link
Author

For some reason, completely unknown to me, removing all nav_bar_items from wp_posts made it work. They definitely have title though...

@Krastanov
Copy link
Author

So here is my workaround.

In Wordpress' control panel: Appearance->Menus: remove the "Pages" menu. This removes all post_type=nav_bar_item from wp_posts. Now the import should work.

I do not know why this happens, but I believe a fix for this would be to blacklist nav_bar_item from def self.process_post(post, db, options) in lib/juvia/migrators/word_press.rb.

@Krastanov
Copy link
Author

By the way the workaround does not remove these pages (i.e. topics), just the references to them for the navbar. And at least some of these pages do not contain comments at all, but when in the navbar still cause problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants