[Rt-commit] rt branch, 4.0/validate-dashboard-args, updated. rt-4.0.0rc6-124-g62f6b13

Shawn Moore sartak at bestpractical.com
Wed Mar 9 11:47:47 EST 2011


The branch, 4.0/validate-dashboard-args has been updated
       via  62f6b13fc461e067aebb864ba2b82c9bf64c4418 (commit)
      from  0a02665e0ca686a8083dc7c02a5b558bf118ec83 (commit)

Summary of changes:
 share/html/Dashboards/Modify.html       |    2 +-
 share/html/Dashboards/Render.html       |    2 +-
 share/html/Dashboards/Subscription.html |   11 +++++------
 3 files changed, 7 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit 62f6b13fc461e067aebb864ba2b82c9bf64c4418
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Mar 9 11:36:02 2011 -0500

    Unify dashboard load failure Abort calls

diff --git a/share/html/Dashboards/Modify.html b/share/html/Dashboards/Modify.html
index af1bde3..3be4917 100644
--- a/share/html/Dashboards/Modify.html
+++ b/share/html/Dashboards/Modify.html
@@ -119,7 +119,7 @@ else {
     }
     else {
         my ($ok, $msg) = $Dashboard->LoadById($id);
-        $ok || Abort($msg);
+        $ok || Abort(loc("Couldn't load dashboard [_1]: [_2]", $id, $msg));
     }
 
     if ($id) {
diff --git a/share/html/Dashboards/Render.html b/share/html/Dashboards/Render.html
index 4c4e2c5..52c3d59 100644
--- a/share/html/Dashboards/Render.html
+++ b/share/html/Dashboards/Render.html
@@ -96,7 +96,7 @@
 use RT::Dashboard;
 my $DashboardObj = RT::Dashboard->new($session{'CurrentUser'});
 my ($ok, $msg) = $DashboardObj->LoadById($id);
-Abort(loc("Couldn't load dashboard [_1]: [_2]", $id, $msg)) if !$ok;
+$ok || Abort(loc("Couldn't load dashboard [_1]: [_2]", $id, $msg));
 
 my $SubscriptionObj = RT::Attribute->new($session{'CurrentUser'});
 my $rows;
diff --git a/share/html/Dashboards/Subscription.html b/share/html/Dashboards/Subscription.html
index 76bf31c..ca58244 100644
--- a/share/html/Dashboards/Subscription.html
+++ b/share/html/Dashboards/Subscription.html
@@ -189,14 +189,13 @@
 <%INIT>
 
 my ($title, @results);
-my ($val, $msg);
 my $Loaded = 0;
 my $timezone = $session{'CurrentUser'}->UserObj->Timezone || RT->Config->Get('Timezone');
 
 use RT::Dashboard;
 my $DashboardObj = RT::Dashboard->new($session{'CurrentUser'});
-($val, $msg) = $DashboardObj->LoadById($id);
-$val || Abort(loc("Couldn't load dashboard [_1]: [_2].", $id, $msg));
+my ($ok, $msg) = $DashboardObj->LoadById($id);
+$ok || Abort(loc("Couldn't load dashboard [_1]: [_2]", $id, $msg));
 
 my $SubscriptionObj = $DashboardObj->Subscription;
 
@@ -232,7 +231,7 @@ if (defined $ARGS{Save}) {
     # update
     if ($SubscriptionObj) {
         $id = delete $fields{'DashboardId'}; # immutable
-        ($val, $msg) = $SubscriptionObj->SetSubValues(%fields);
+        ($ok, $msg) = $SubscriptionObj->SetSubValues(%fields);
         $fields{'DashboardId'} = $id;
 
         # not so good to spew base64-encoded data at the user :)
@@ -248,14 +247,14 @@ if (defined $ARGS{Save}) {
             unless $DashboardObj->CurrentUserCanSubscribe;
 
         $SubscriptionObj = RT::Attribute->new($session{CurrentUser});
-        my ($val, $msg) = $SubscriptionObj->Create(
+        ($ok, $msg) = $SubscriptionObj->Create(
             Name        => 'Subscription',
             Description => 'Subscription to dashboard ' . $id,
             ContentType => 'storable',
             Object      => $session{'CurrentUser'}->UserObj,
             Content     => \%fields,
         );
-        if ($val) {
+        if ($ok) {
             push @results, loc("Subscribed to dashboard [_1]", $DashboardObj->Name);
             push @results, loc("Warning: you have no email address set, so you will not receive this dashboard until you have it set")
                 unless $session{'CurrentUser'}->EmailAddress || $fields{Recipient};

-----------------------------------------------------------------------


More information about the Rt-commit mailing list