From 255abcdf9714ed3cc3e2f4ed55485ba5ee9ed9e8 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 17 Sep 2009 15:36:58 -0700 Subject: [PATCH] Set correct defaults for icalFeeds in existant calendars. Fixes bug #11005 --- docs/changelog/7.x.x.txt | 1 + docs/upgrades/upgrade_7.7.19-7.8.0.pl | 14 ++++++++++++++ t/Asset/Wobject/Calendar.t | 24 +++++++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 0272e52db..24db4ff53 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -48,6 +48,7 @@ - fixed #10954: DataForm fails silently - fixed #10950: Thingy - fixed #10976: Form::Date not internationalized /DateTime::setToEpoch + - fixed #11005: calendar feed workflow 7.7.19 - fixed #10838: Forwarded forum post email to new CS adds reply to original thread diff --git a/docs/upgrades/upgrade_7.7.19-7.8.0.pl b/docs/upgrades/upgrade_7.7.19-7.8.0.pl index 327385caa..b4257cd27 100644 --- a/docs/upgrades/upgrade_7.7.19-7.8.0.pl +++ b/docs/upgrades/upgrade_7.7.19-7.8.0.pl @@ -36,6 +36,7 @@ fixTemplateSettingsFromShunt($session); addSubscribableAspect( $session ); addMatrixColumnDefaults($session); addFeaturedPageWiki( $session ); +fixEmptyCalendarIcalFeeds( $session ); finish($session); # this line required @@ -49,6 +50,19 @@ finish($session); # this line required # print "DONE!\n" unless $quiet; #} +#---------------------------------------------------------------------------- +# Add the column for featured wiki pages +sub fixEmptyCalendarIcalFeeds { + my $session = shift; + print "\tSetting icalFeeds in the Calendar to the proper default... " unless $quiet; + + $session->db->write( + "UPDATE Calendar set icalFeeds='[]' where icalFeeds IS NULL", + ); + + print "DONE!\n" unless $quiet; +} + #---------------------------------------------------------------------------- # Add the column for featured wiki pages sub addFeaturedPageWiki { diff --git a/t/Asset/Wobject/Calendar.t b/t/Asset/Wobject/Calendar.t index a7fc8578a..11e7dd9b8 100644 --- a/t/Asset/Wobject/Calendar.t +++ b/t/Asset/Wobject/Calendar.t @@ -57,7 +57,7 @@ use Data::Dumper; use WebGUI::Asset::Wobject::Calendar; use WebGUI::Asset::Event; -plan tests => 14 + scalar @icalWrapTests; +plan tests => 15 + scalar @icalWrapTests; my $session = WebGUI::Test->session; @@ -434,6 +434,28 @@ cmp_deeply( '... end of day event in proper bin' ); +###################################################################### +# +# getFeeds +# +###################################################################### + +my $feedCal = $node->addChild({ + className => 'WebGUI::Asset::Wobject::Calendar', + title => 'Calendar for doing feed tests', +}); + +my $feedTag = WebGUI::VersionTag->getWorking($session); +$feedTag->set({name=>"Calendar Feed Test"}); +WebGUI::Test->tagsToRollback($feedTag); +$feedTag->commit; + +cmp_deeply( + $feedCal->getFeeds(), + [], + 'getFeeds: returns an empty array ref with no feeds' +); + TODO: { local $TODO = "Tests to make later"; ok(0, 'Lots more to test');