[Rt-commit] rt branch, 4.4/dashboard-subscription-user-group-fix, created. rt-4.4.0rc2-22-gc017917
Dustin Graves
dustin at bestpractical.com
Tue Jan 19 17:23:36 EST 2016
The branch, 4.4/dashboard-subscription-user-group-fix has been created
at c01791743f9d99b31d40e5d77f938c2824e69f16 (commit)
- Log -----------------------------------------------------------------
commit c01791743f9d99b31d40e5d77f938c2824e69f16
Author: Dustin Graves <dustin at bestpractical.com>
Date: Tue Jan 19 22:20:13 2016 +0000
add fix for dashboard subscription rights requirement and message in case of any failure
remove setting of RealName field on user creation from dashboard subscription
diff --git a/share/html/Dashboards/Subscription.html b/share/html/Dashboards/Subscription.html
index cb45f1b..f480366 100644
--- a/share/html/Dashboards/Subscription.html
+++ b/share/html/Dashboards/Subscription.html
@@ -253,20 +253,24 @@ 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($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;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list