With the 'Past Date' option set to 'Publish Immediately' the node is correctly published when entering a date in the past. However, the publish_on date is not removed, but is set to 1970-01-01 i.e. timestamp value zero. This is how it used to be done in 7.x but in 8.x the date value should be set to NULL.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jonathan1055 created an issue. See original summary.

  • jonathan1055 committed 4e3f118 on 8.x-1.x
    Issue #2666832, #2594615 by jonathan1055: Check for NULL date in...
jonathan1055’s picture

FileSize
50.76 KB

Attached is what you get in the Scheduled tab.

I have added an extra assertion in SchedulerPastDatesTests to check that the value is NULL, to make sure we fix it and do not regress. This class was passing but now it has one failure.

1	1	Scheduler.Drupal\scheduler\Tests\SchedulerPastDatesTest
✓		- setUp
	✗	
testSchedulerPastDates

fail: [Other] Line 60 of modules/scheduler/src/Tests/SchedulerPastDatesTest.php:
The node publish_on date has been removed after publishing when the "publish" behavior is chosen.

Should be a trivial fix to make, though.

jonathan1055’s picture

In addition to the zero in scheduler_node_presave() there are also two places in .rules.inc which remove the dates. Even though the whole Rules functionality has not been converted yet #2651348: Port Rules integration for Scheduler to Drupal 8 this change might as well be done here in one place.

Status: Needs review » Needs work

The last submitted patch, 4: 2666832-4.past-date-set-publish-on-to-null-not-zero.patch, failed testing.

jonathan1055’s picture

Status: Needs work » Needs review

Good. As expected the SchedulerPastDates is now green with a full set of passes.
Manual testing is also OK, the date is removed.
Setting back to 'needs review' for other folk to verify the change.

pfrenssen’s picture

Status: Needs review » Reviewed & tested by the community

Looking good, thanks!

  • jonathan1055 committed 8b885b2 on 8.x-1.x
    Issue #2666832 by jonathan1055: Publish in the past sets date to 1970-01...
jonathan1055’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the review. Fixed.

2		Scheduler.Drupal\scheduler\Tests\SchedulerPastDatesTest
✓		- setUp
✓		- testSchedulerPastDates

... and an extra class passes. Now 23 passes and 5 fails.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.