fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-09-22 08:12 am

[dw-free] Rename email text issues

[commit: http://hg.dwscoalition.org/dw-free/rev/e77ea2e7ad94]

http://bugs.dwscoalition.org/show_bug.cgi?id=3074

Tweak site copy and messages to be more accurate and to be site-agnostic.

Patch by [personal profile] fu.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/DW/Shop/Cart.pm
  • cgi-bin/DW/Shop/Item.pm
  • cgi-bin/DW/Shop/Item/Account.pm
  • cgi-bin/DW/Shop/Item/Points.pm
  • cgi-bin/DW/Shop/Item/Rename.pm
  • cgi-bin/LJ/NotificationMethod/Email.pm
--------------------------------------------------------------------------------
diff -r 6de598adaf3d -r e77ea2e7ad94 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Tue Sep 21 23:26:43 2010 +0800
+++ b/bin/upgrading/en.dat	Wed Sep 22 16:12:01 2010 +0800
@@ -1800,7 +1800,7 @@ On [[date]] at [[time]] your username wa
 
 If you made this change yourself, this email serves as a confirmation of your change.
 
-If you did not change your username, it means that your journal's security was compromised. Please contact Support [http://www.dreamwidth.org/support] to learn what steps you should take to resecure your journal.
+If you did not change your username, it means that your journal's security was compromised. Please contact Support [[[siteroot]]/support] to learn what steps you should take to resecure your journal.
 
 This letter was sent out automatically to help you keep your account secure. You cannot opt-out of receiving these letters.
 .
@@ -3629,11 +3629,13 @@ shop.item.points.canbeadded.outofrange=M
 
 shop.item.points.name=[[num]] [[sitename]] Points
 
-shop.item.rename.canbeadded.invalidjournaltype=You can only send a rename token to a personal journal. If you wish to rename a community journal, please <a [[aopts]]>contact site administrators</a>.
+shop.item.rename.canbeadded.invalidjournaltype=You can only send a rename token to a personal journal. To rename a community, have a community administrator use the token.
 
 shop.item.rename.name.notoken=[[points]] points for a Rename Token
 
 shop.item.rename.name.hastoken=Rename Token <a [[aopts]]>[[token]]</a>
+
+shop.item.rename.name.hastoken.text=Rename Token [[token]]
 
 sitescheme.accountlinks.account=Account
 
diff -r 6de598adaf3d -r e77ea2e7ad94 cgi-bin/DW/Shop/Cart.pm
--- a/cgi-bin/DW/Shop/Cart.pm	Tue Sep 21 23:26:43 2010 +0800
+++ b/cgi-bin/DW/Shop/Cart.pm	Wed Sep 22 16:12:01 2010 +0800
@@ -556,7 +556,7 @@ sub _notify_buyer_paid {
     push @payment_methods, $self->total_points . ' points'
         if $self->total_points;
 
-    my $itemlist = join( "\n", map { "  * " . $_->short_desc } @{$self->items} );
+    my $itemlist = join( "\n", map { "  * " . $_->short_desc( nohtml => 1 ) } @{$self->items} );
 
     LJ::send_mail( {
         to       => $self->email,
diff -r 6de598adaf3d -r e77ea2e7ad94 cgi-bin/DW/Shop/Item.pm
--- a/cgi-bin/DW/Shop/Item.pm	Tue Sep 21 23:26:43 2010 +0800
+++ b/cgi-bin/DW/Shop/Item.pm	Wed Sep 22 16:12:01 2010 +0800
@@ -255,17 +255,28 @@ sub t_html {
     return "<strong>invalid/unknown target</strong>";
 }
 
+=head2 C<< $self->name_text >>
 
-=head2 C<< $self->name_html >>
-
-Render the item name as a string, for display.
+Render the item name as a string, for display, to be used in contexts which don't allow HTML.
 
 Subclasses must override to provide a more specific and user-friendly display name.
 
 =cut
 
+sub name_text {
+    return ref $_[0];
+}
+
+=head2 C<< $self->name_html >>
+
+Render the item name as a string for display, to be used in contexts which accept HTML.
+
+Subclasses may override to provide a version of the name containing HTML. Uses $self->name_text by default.
+
+=cut
+
 sub name_html {
-    return ref $_[0];
+    return $_[0]->name_text;
 }
 
 
@@ -278,10 +289,10 @@ Subclasses may override to provide furth
 =cut
 
 sub short_desc {
-    my $self = $_[0];
+    my ( $self, %opts ) = @_;
 
     # does not contain HTML, I hope
-    my $desc = $self->name_html;
+    my $desc = $opts{nohtml} ? $self->name_text : $self->name_html;
 
     my $for = $self->t_email;
     unless ( $for ) {
diff -r 6de598adaf3d -r e77ea2e7ad94 cgi-bin/DW/Shop/Item/Account.pm
--- a/cgi-bin/DW/Shop/Item/Account.pm	Tue Sep 21 23:26:43 2010 +0800
+++ b/cgi-bin/DW/Shop/Item/Account.pm	Wed Sep 22 16:12:01 2010 +0800
@@ -366,7 +366,7 @@ sub t_html {
 
 
 # override
-sub name_html {
+sub name_text {
     my $self = $_[0];
 
     my $name = $self->class_name;
diff -r 6de598adaf3d -r e77ea2e7ad94 cgi-bin/DW/Shop/Item/Points.pm
--- a/cgi-bin/DW/Shop/Item/Points.pm	Tue Sep 21 23:26:43 2010 +0800
+++ b/cgi-bin/DW/Shop/Item/Points.pm	Wed Sep 22 16:12:01 2010 +0800
@@ -166,7 +166,7 @@ sub can_be_added {
 
 
 # override
-sub name_html {
+sub name_text {
     my $self = $_[0];
 
     return LJ::Lang::ml( 'shop.item.points.name', { num => $self->points, sitename => $LJ::SITENAMESHORT } );
diff -r 6de598adaf3d -r e77ea2e7ad94 cgi-bin/DW/Shop/Item/Rename.pm
--- a/cgi-bin/DW/Shop/Item/Rename.pm	Tue Sep 21 23:26:43 2010 +0800
+++ b/cgi-bin/DW/Shop/Item/Rename.pm	Wed Sep 22 16:12:01 2010 +0800
@@ -50,6 +50,12 @@ sub new {
     return $self;
 }
 
+#override
+sub name_text {
+    return $_[0]->token && $_[0]->from_userid == $_[0]->t_userid
+        ? LJ::Lang::ml( 'shop.item.rename.name.hastoken.text', { token => $_[0]->token } )
+        : LJ::Lang::ml( 'shop.item.rename.name.notoken', { points => $_[0]->cost_points } );
+}
 
 # override
 sub name_html {
diff -r 6de598adaf3d -r e77ea2e7ad94 cgi-bin/LJ/NotificationMethod/Email.pm
--- a/cgi-bin/LJ/NotificationMethod/Email.pm	Tue Sep 21 23:26:43 2010 +0800
+++ b/cgi-bin/LJ/NotificationMethod/Email.pm	Wed Sep 22 16:12:01 2010 +0800
@@ -86,7 +86,9 @@ sub notify {
         my $plain_body = LJ::Hooks::run_hook("esn_email_plaintext", $ev, $u);
         unless ($plain_body) {
             $plain_body = $ev->as_email_string($u) or next;
-            $plain_body .= $footer;
+
+            # only append the footer if we can see this event on the subscription interface
+            $plain_body .= $footer if $ev->is_visible;
         }
 
         # run transform hook on plain body
@@ -130,7 +132,9 @@ sub notify {
 
                  # convert newlines in HTML mail
                  $html_body =~ s/\n/\n<br\/>/g unless $html_body =~ m!<br!i;
-                 $html_body .= $html_footer;
+
+                 # only append the footer if we can see this event on the subscription interface
+                 $html_body .= $html_footer if $ev->is_visible;
 
                  # run transform hook on html body
                  LJ::Hooks::run_hook("esn_email_html_transform", event => $ev, rcpt_u => $u, bodyref => \$html_body);
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org