[Bps-public-commit] rtx-calendar branch multiple-days-events-2 updated. 1.05-29-g8e330c0
BPS Git Server
git at git.bestpractical.com
Tue Dec 12 00:48:00 UTC 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rtx-calendar".
The branch, multiple-days-events-2 has been updated
via 8e330c04d7b77718b09e6971aa176f2ba614e072 (commit)
from 2c58effef8d61a3525a0faffcba5be7cb0fe748f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8e330c04d7b77718b09e6971aa176f2ba614e072
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Mon Dec 11 21:38:27 2023 -0300
Fix popup helper crash when no CalendarPopupFields were defined
The new version of the calendar extension implemented an asynchronous
loading of the popup with the event details.
When we moved the code that renders the popup to a helper, we were
relying on the fact that the CalendarPopupFields were always defined
and we forgot to test a case where they were not, and it turns out
that this case generates a crash.
This patch fixes the issue by moving the original code from the
popup that was used for defining a default field set to the new
extension configuration file, following the same pattern as the
other configuration options of the extension.
diff --git a/etc/RTxCalendar_Config.pm b/etc/RTxCalendar_Config.pm
index 3fead2c..d931763 100644
--- a/etc/RTxCalendar_Config.pm
+++ b/etc/RTxCalendar_Config.pm
@@ -23,4 +23,17 @@ Set(@CalendarFilterStatuses, qw(new open stalled rejected resolved));
Set(@CalendarFilterDefaultStatuses, qw(new open));
+Set(@CalendarPopupFields, (
+ "OwnerObj->Name",
+ "CreatedObj->ISO",
+ "StartsObj->ISO",
+ "StartedObj->ISO",
+ "LastUpdatedObj->ISO",
+ "DueObj->ISO",
+ "ResolvedObj->ISO",
+ "Status",
+ "Priority",
+ "Requestors->MemberEmailAddressesAsString",
+));
+
1;
diff --git a/html/Helpers/CalendarEventInfo b/html/Helpers/CalendarEventInfo
index 125fb8f..5ed430e 100644
--- a/html/Helpers/CalendarEventInfo
+++ b/html/Helpers/CalendarEventInfo
@@ -27,14 +27,6 @@ if ($Object->Type eq 'reminder') {
my @display_fields = RT->Config->Get('CalendarPopupFields');
-# default
-if (0 == @display_fields) {
- @display_fields = qw(OwnerObj->Name CreatedObj->ISO StartsObj->ISO
- StartedObj->ISO LastUpdatedObj->ISO DueObj->ISO
- ResolvedObj->ISO Status Priority
- Requestors->MemberEmailAddressesAsString);
-}
-
my %label_of;
for my $field (@display_fields) {
my $label = $field;
@@ -74,10 +66,7 @@ foreach my $attr (@display_fields) {
my $method = '$Object->'.$attr.'()';
$method =~ s/->ISO\(\)$/->ISO( Timezone => 'user' )/;
$value = eval $method;
- if ($@) {
- RT->Logger->error("Check your CalendarPopupFields config. Failed to find \"$attr\" - ". $@);
- $value = '-';
- };
+ if ($@) {die "<b>Check your CalendarPopupFields config in etc/RT_SiteConfig.pm</b>.<br /><br />Failed to find \"$attr\" - ". $@};
}
</%perl>
<strong><&|/l&><% $label_of{$attr} %></&>:</strong> <% $value %><br />
-----------------------------------------------------------------------
Summary of changes:
etc/RTxCalendar_Config.pm | 13 +++++++++++++
html/Helpers/CalendarEventInfo | 13 +------------
2 files changed, 14 insertions(+), 12 deletions(-)
hooks/post-receive
--
rtx-calendar
More information about the Bps-public-commit
mailing list