[Rt-commit] rt branch, 4.2/email-frequency, created. rt-4.2.9-62-g755aa9b

Alex Vandiver alexmv at bestpractical.com
Mon Dec 29 18:14:44 EST 2014


The branch, 4.2/email-frequency has been created
        at  755aa9b14016bf579c507a3f48563992e5433092 (commit)

- Log -----------------------------------------------------------------
commit 1e2232376426b7413e1c33f50035c911486464aa
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Dec 29 18:09:54 2014 -0500

    Expand, and mark for localization, EmailFrequency properties
    
    Fixes I#30424

diff --git a/lib/RT/User.pm b/lib/RT/User.pm
index dbf680d..d26bd2c 100644
--- a/lib/RT/User.pm
+++ b/lib/RT/User.pm
@@ -633,25 +633,13 @@ sub SetEmailAddress {
 
 =head2 EmailFrequency
 
-Takes optional Ticket argument in paramhash. Returns 'no email',
-'squelched', 'daily', 'weekly' or empty string depending on
-user preferences.
+Takes optional Ticket argument in paramhash. Returns a string, suitable
+for localization, describing any notable properties about email delivery
+to the user.  This includes lack of email address, ticket-level
+squelching (if C<Ticket> is provided in the paramhash), or user email
+delivery preferences.
 
-=over 4
-
-=item 'no email' - user has no email, so can not recieve notifications.
-
-=item 'squelched' - returned only when Ticket argument is provided and
-notifications to the user has been supressed for this ticket.
-
-=item 'daily' - retruned when user recieve daily messages digest instead
-of immediate delivery.
-
-=item 'weekly' - previous, but weekly.
-
-=item empty string returned otherwise.
-
-=back
+Returns the empty string if there are no notable properties.
 
 =cut
 
@@ -663,12 +651,16 @@ sub EmailFrequency {
     );
     return '' unless $self->id && $self->id != RT->Nobody->id
         && $self->id != RT->SystemUser->id;
-    return 'no email address' unless my $email = $self->EmailAddress;
-    return 'email disabled for ticket' if $args{'Ticket'} &&
-        grep lc $email eq lc $_->Content, $args{'Ticket'}->SquelchMailTo;
+    return 'no email address set'  # loc
+        unless my $email = $self->EmailAddress;
+    return 'email disabled for ticket' # loc
+        if $args{'Ticket'} &&
+            grep lc $email eq lc $_->Content, $args{'Ticket'}->SquelchMailTo;
     my $frequency = RT->Config->Get( 'EmailFrequency', $self ) || '';
-    return 'daily' if $frequency =~ /daily/i;
-    return 'weekly' if $frequency =~ /weekly/i;
+    return 'receives daily digests' # loc
+        if $frequency =~ /daily/i;
+    return 'receives weekly digests' # loc
+        if $frequency =~ /weekly/i;
     return '';
 }
 

commit 755aa9b14016bf579c507a3f48563992e5433092
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Dec 29 18:11:37 2014 -0500

    Also display "email suspended" property
    
    5ac4fced, which added the ->EmailFrequency method, neglected to include
    a response for the case if the user had selected email to be suspended
    entirely; see DeferDigestRecipients in RT::Action::SendEmail.

diff --git a/lib/RT/User.pm b/lib/RT/User.pm
index d26bd2c..05b7e9a 100644
--- a/lib/RT/User.pm
+++ b/lib/RT/User.pm
@@ -661,6 +661,8 @@ sub EmailFrequency {
         if $frequency =~ /daily/i;
     return 'receives weekly digests' # loc
         if $frequency =~ /weekly/i;
+    return 'email delivery suspended' # loc
+        if $frequency =~ /suspend/i;
     return '';
 }
 

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


More information about the rt-commit mailing list