[Bps-public-commit] rtx-calendar branch multiple-days-events-2 created. 1.05-29-g1ae9fd9
BPS Git Server
git at git.bestpractical.com
Tue Dec 12 21:46:59 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 created
at 1ae9fd9b25d4bc80504d32bdef82cc8a694c7a75 (commit)
- Log -----------------------------------------------------------------
commit 1ae9fd9b25d4bc80504d32bdef82cc8a694c7a75
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Tue Dec 12 18:46:41 2023 -0300
Restore the default popup configuration
After moving the popup content rendering to a helper for loading it
asynchronously, we were relying on the fact that the CalendarPopupFields
were always defined and it turns old "hardcoded" default config was not
working anymore, leading to a situation where the popup attributes were
not defined and the popup was not rendered at all.
This patch moves the default popup configuration to the new config file
of the extension to be consistent with the other default configurations.
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..b5b1872 100644
--- a/html/Helpers/CalendarEventInfo
+++ b/html/Helpers/CalendarEventInfo
@@ -25,15 +25,11 @@ if ($Object->Type eq 'reminder') {
$status = $Object->Status;
}
-my @display_fields = RT->Config->Get('CalendarPopupFields');
+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);
-}
+RT->Logger
+ ->warning("No CalendarPopupFields defined. Popups will have no extra information.")
+ unless @display_fields;
my %label_of;
for my $field (@display_fields) {
commit 2c58effef8d61a3525a0faffcba5be7cb0fe748f
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date: Fri Dec 1 17:21:50 2023 -0300
Avoid popup helper to die when attribute is not found
The original code of last Calendar version was designed to stop RT
when an attribute was not found. This is not necessary anymore, as
the helper loads the attribute asynchonously and we should not stop
RT in any case.
This patch fixes it.
diff --git a/html/Helpers/CalendarEventInfo b/html/Helpers/CalendarEventInfo
index cca3221..125fb8f 100644
--- a/html/Helpers/CalendarEventInfo
+++ b/html/Helpers/CalendarEventInfo
@@ -74,7 +74,10 @@ foreach my $attr (@display_fields) {
my $method = '$Object->'.$attr.'()';
$method =~ s/->ISO\(\)$/->ISO( Timezone => 'user' )/;
$value = eval $method;
- if ($@) {die "<b>Check your CalendarPopupFields config in etc/RT_SiteConfig.pm</b>.<br /><br />Failed to find \"$attr\" - ". $@};
+ if ($@) {
+ RT->Logger->error("Check your CalendarPopupFields config. Failed to find \"$attr\" - ". $@);
+ $value = '-';
+ };
}
</%perl>
<strong><&|/l&><% $label_of{$attr} %></&>:</strong> <% $value %><br />
-----------------------------------------------------------------------
hooks/post-receive
--
rtx-calendar
More information about the Bps-public-commit
mailing list