[Rt-commit] rt branch, 4.4/dashboard-subscription-user-group-fix, created. rt-4.4.0-222-gbf6f1a2

Dustin Graves dustin at bestpractical.com
Tue May 17 15:40:00 EDT 2016


The branch, 4.4/dashboard-subscription-user-group-fix has been created
        at  bf6f1a259f8d1d387db092ae476e41669c09b33e (commit)

- Log -----------------------------------------------------------------
commit b483a1c70d8c8c9054b1982b3f41c6f3140902aa
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Tue May 17 19:29:36 2016 +0000

    change dashboard subscription user loading to use RT->SystemUser and output any user load/create failure message

diff --git a/share/html/Dashboards/Subscription.html b/share/html/Dashboards/Subscription.html
index 262f853..7304b53 100644
--- a/share/html/Dashboards/Subscription.html
+++ b/share/html/Dashboards/Subscription.html
@@ -279,18 +279,23 @@ if (defined $ARGS{Save}) {
             for ( RT::EmailParser->ParseEmailAddress( $val ) ) {
                 my ( $email, $name ) = ( $_->address, $_->name );
 
-                my $user = RT::User->new($session{CurrentUser});
-                $user->LoadOrCreateByEmail(
+                my $user = RT::User->new(RT->SystemUser);
+                ($ok, $msg) = $user->LoadOrCreateByEmail(
                     EmailAddress => $email,
                     RealName     => $name,
                     Comments     => 'Autocreated when added as a dashboard subscription recipient',
                 );
 
-                my $is_prev_recipient = grep { $_ == $user->id } @recipients;
-                if ( not $is_prev_recipient ) {
-                    push @recipients, $user->id;
-                    push @results, loc("[_1] added to dashboard subscription recipients", $email);
+                unless ($ok) {
+                    push @results, loc("Could not add [_1] as a recipient: [_2]", $email, $msg);
+                    next;
                 }
+
+                my $is_prev_recipient = grep { $_ == $user->id } @recipients;
+                next if $is_prev_recipient;
+
+                push @recipients, $user->id;
+                push @results, loc("[_1] added to dashboard subscription recipients", $email);
             }
             @{ $fields{Recipients}->{Users} } = uniq @recipients;
 

commit bf6f1a259f8d1d387db092ae476e41669c09b33e
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Tue May 17 19:34:48 2016 +0000

    don't set RealName on dashboard subscription user creation
    
    this is to be consistent with other RT behavior, e.g.
    user at domain.com was setting RealName to 'user', which RT typically does not do

diff --git a/share/html/Dashboards/Subscription.html b/share/html/Dashboards/Subscription.html
index 7304b53..34aaa33 100644
--- a/share/html/Dashboards/Subscription.html
+++ b/share/html/Dashboards/Subscription.html
@@ -277,12 +277,11 @@ if (defined $ARGS{Save}) {
             my @recipients = @{ $fields{Recipients}->{Users} };
 
             for ( RT::EmailParser->ParseEmailAddress( $val ) ) {
-                my ( $email, $name ) = ( $_->address, $_->name );
+                my $email = $_->address;
 
                 my $user = RT::User->new(RT->SystemUser);
                 ($ok, $msg) = $user->LoadOrCreateByEmail(
                     EmailAddress => $email,
-                    RealName     => $name,
                     Comments     => 'Autocreated when added as a dashboard subscription recipient',
                 );
 

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


More information about the rt-commit mailing list