getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.31k stars 168 forks source link

Saving a page with automatic order sets status to unlisted #944

Closed pju- closed 6 years ago

pju- commented 6 years ago

If you define a value for automatic order (such as num: date) in the blueprint for a page, the num number is set correctly when you switch the page status to published, but lost once you re-save the page.

This issue can be easily reproduced in the starterkit (tested: Beta 4, Beta 5):

  1. Go to Blog -> Content in Kirby
  2. Change something in the text or just hit cmd + s
  3. If you go back to the blog overview or just hit F5 the page status is now unlisted (In Review )

How to fix For me changing PageActions/update does the trick. You need to pass a dummy num to changeNum.

// if num is created from page content, update num on content update
    if ($this->isListed() === true && in_array($this->blueprint()->num(), ['zero', 'default']) === false) {
    $this->changeNum(1);
}

I would create a pull request for this, but I'm not 100% sure that always passing 1 as a dummy value for num is correct.

bastianallgeier commented 6 years ago

Yep, that did the trick. Thank you :)