Permalink.create(url: /my/path, post_id: 123) no longer works

This commit UX: redesign admin permalinks page (#29634) · discourse/discourse@42b1ca8 · GitHub

seems to have broken the expected behavior of Permalink.create. Rather than being able to call it with a post_id or topic_id as it once worked (and is what a Ruby programmer would expect?), you now need to call it like this:

          Permalink.create!(url: "/my/path/#{import_id}.html", permalink_type_value: pcf.post_id, permalink_type: "post") 

This breaks all of the import scripts that create permalinks ( ./vanilla_mysql.rb ./zendesk.rb ./muut.rb ./vbulletin3.rb ./jforum.rb ./ipboard.rb ./bbpress.rb ./answerhub.rb ./vbulletin.rb ./mylittleforum.rb ./nodebb/nodebb.rb./telligent.rb ./mybb.rb ./question2answer.rb./smf2.rb ./vbulletin5.rb ./phpbb3/importers/permalink_importer.rb ./phorum.rb./answerbase.rb./drupal.rb./zendesk_api.rb)
And calls like find_or_create_by also don’t work anymore (breaking vbulletin3, smf1, xenforo, and getsatisfaction).

Is this expected?

It seems that the tests were also changed to support this new behavior, so maybe so?

6개의 좋아요

I created a PR with a possible solution:

https://github.com/discourse/discourse/pull/29895

7개의 좋아요

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.