fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-11-25 03:02 pm

[dw-free] PM privacy option is misplaced

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

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

Move PM setting to account settinsg (from /manage/profile)

Patch by [personal profile] ninetydegrees.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/DW/Setting/ContactInfo.pm
  • cgi-bin/DW/Setting/TxtMsgSetup.pm
  • cgi-bin/LJ/Setting/UserMessaging.pm
  • htdocs/manage/profile/index.bml
  • htdocs/manage/profile/index.bml.text
  • htdocs/manage/settings/index.bml
--------------------------------------------------------------------------------
diff -r 40273080754d -r 86cf3e970e64 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Fri Nov 25 22:51:19 2011 +0800
+++ b/bin/upgrading/en.dat	Fri Nov 25 23:02:14 2011 +0800
@@ -2903,6 +2903,24 @@
 
 setting.txtmsgsetup.vis=Who can send you text messages?
 
+setting.usermessaging.error.invalid=Invalid selection.
+
+setting.usermessaging.label=[[siteabbrev]] Private Messages
+
+setting.usermessaging.opt.a=Everyone
+
+setting.usermessaging.opt.f=Access List Only
+
+setting.usermessaging.opt.m=Only Mutually Trusted
+
+setting.usermessaging.opt.n=Nobody
+
+setting.usermessaging.opt.y=Registered Accounts
+
+setting.usermessaging.option=Receive messages from:
+
+setting.usermessaging.option.note=Only registered [[sitename]] users can send you messages. You also have options to receive messages only from users on your Access List.
+
 setting.viewingadultcontent.error.invalid=Invalid viewing adult content setting.
 
 setting.viewingadultcontent.label=Viewing Adult Content
@@ -3049,23 +3067,7 @@
 
 settings.state.us=US States
 
-settings.usermessaging.error.invalid=Invalid Option
-
-settings.usermessaging.helper=Only registered [[sitename]] users can send you messages. You also have options to receive messages only from users on your Access List.
-
-settings.usermessaging.label=[[siteabbrev]] Private Messages
-
-settings.usermessaging.opt.a=Everyone
-
-settings.usermessaging.opt.F=Access List Only
-
-settings.usermessaging.opt.M=Only Mutually Trusted
-
-settings.usermessaging.opt.N=Nobody
-
-settings.usermessaging.opt.Y=Registered Accounts
-
-settings.usermessaging.question=Receive messages from:
+settings.usermessaging.obsolete=OBSOLETE: this option has been moved to Account Settings.
 
 settings.yearofbirth=Year of Birth
 
diff -r 40273080754d -r 86cf3e970e64 cgi-bin/DW/Setting/ContactInfo.pm
--- a/cgi-bin/DW/Setting/ContactInfo.pm	Fri Nov 25 22:51:19 2011 +0800
+++ b/cgi-bin/DW/Setting/ContactInfo.pm	Fri Nov 25 23:02:14 2011 +0800
@@ -36,10 +36,10 @@
     my $contactinfo = $class->get_arg( $args, "contactinfo" ) || $u->opt_showcontact;
 
     my @options = (
-        "Y" => $class->ml( 'settings.usermessaging.opt.a' ),
-        "R" => $class->ml( 'settings.usermessaging.opt.y' ),
-        "F" => $class->ml( 'settings.usermessaging.opt.f' ),
-        "N" => $class->ml( 'settings.usermessaging.opt.n' ),
+        "Y" => $class->ml( 'setting.usermessaging.opt.a' ),
+        "R" => $class->ml( 'setting.usermessaging.opt.y' ),
+        "F" => $class->ml( 'setting.usermessaging.opt.f' ),
+        "N" => $class->ml( 'setting.usermessaging.opt.n' ),
     );
 
     my $ret;
diff -r 40273080754d -r 86cf3e970e64 cgi-bin/DW/Setting/TxtMsgSetup.pm
--- a/cgi-bin/DW/Setting/TxtMsgSetup.pm	Fri Nov 25 22:51:19 2011 +0800
+++ b/cgi-bin/DW/Setting/TxtMsgSetup.pm	Fri Nov 25 23:02:14 2011 +0800
@@ -91,10 +91,10 @@
     my $security = $class->get_arg( $args, "txtmsg_security" ) || $tminfo->{security};
 
     my @opts = (
-        all => $class->ml( "settings.usermessaging.opt.a" ),
-        reg => $class->ml( "settings.usermessaging.opt.y" ),
-        friends => $class->ml( "settings.usermessaging.opt.f" ),
-        none    => $class->ml( "settings.usermessaging.opt.n" ),
+        all => $class->ml( "setting.usermessaging.opt.a" ),
+        reg => $class->ml( "setting.usermessaging.opt.y" ),
+        friends => $class->ml( "setting.usermessaging.opt.f" ),
+        none    => $class->ml( "setting.usermessaging.opt.n" ),
     );
 
     $ret .= LJ::html_select( { name => "${key}txtmsg_security",
diff -r 40273080754d -r 86cf3e970e64 cgi-bin/LJ/Setting/UserMessaging.pm
--- a/cgi-bin/LJ/Setting/UserMessaging.pm	Fri Nov 25 22:51:19 2011 +0800
+++ b/cgi-bin/LJ/Setting/UserMessaging.pm	Fri Nov 25 23:02:14 2011 +0800
@@ -23,7 +23,7 @@
 
 sub label {
     my $class = shift;
-    return $class->ml( 'settings.usermessaging.label',
+    return $class->ml( 'setting.usermessaging.label',
                        { siteabbrev => $LJ::SITENAMEABBREV }
                      );
 }
@@ -31,34 +31,45 @@
 sub option {
     my ($class, $u, $errs, $args) = @_;
     my $key = $class->pkgkey;
+
+    my $usermsg = $class->get_arg($args, "usermsg") || $u->prop("opt_usermsg");
+
+    my @options = (
+        "Y" => $class->ml( 'setting.usermessaging.opt.y' ),
+        "F" => $class->ml( 'setting.usermessaging.opt.f' ),
+        "M" => $class->ml( 'setting.usermessaging.opt.m' ),
+        "N" => $class->ml( 'setting.usermessaging.opt.n' ),
+    );
+
     my $ret;
-    my $helper = ( $args && $args->{helper} == 0 ) ? 0 : 1;
 
-    $ret .= "<label for='${key}opt_usermsg'>" . $class->ml('settings.usermessaging.question') . "</label>"
-        unless $args && $args->{minimal_display};
-    $ret .= LJ::html_select( { name => "${key}opt_usermsg",
-                               id => "${key}opt_usermsg",
-                               class => "select",
-                               title => $class->label,
-                               selected => $u->opt_usermsg },
-                             Y => LJ::Lang::ml('settings.usermessaging.opt.Y'),
-                             F => LJ::Lang::ml('settings.usermessaging.opt.F'),
-                             M => LJ::Lang::ml('settings.usermessaging.opt.M'),
-                             N => LJ::Lang::ml('settings.usermessaging.opt.N'),
-                           );
-    $ret .= "<div class='helper'>" .
-            $class->ml('settings.usermessaging.helper', {
-                sitename => $LJ::SITENAMESHORT }) .
-            "</div>" if $helper;
-    $ret .= $class->errdiv($errs, "opt_usermsg");
+    $ret .= "<label for='${key}usermsg'>";
+    $ret .= $class->ml( 'setting.usermessaging.option' );
+    $ret .= "</label> ";
+
+    $ret .= LJ::html_select( {
+        name => "${key}usermsg",
+        id => "${key}usermsg",
+        selected => $usermsg,
+    }, @options );
+
+    $ret .= "<p class='details'>";
+    $ret .= $class->ml( 'setting.usermessaging.option.note', { sitename  => $LJ::SITENAMESHORT } );
+    $ret .= "</p>";
+
+    my $errdiv = $class->errdiv( $errs, "usermsg" );
+    $ret .= "<br />$errdiv" if $errdiv;
 
     return $ret;
 }
 
 sub error_check {
     my ($class, $u, $args) = @_;
-    my $opt_usermsg= $class->get_arg($args, "opt_usermsg");
-    $class->errors("opt_usermsg" => $class->ml('settings.usermessaging.error.invalid')) unless $opt_usermsg=~ /^[MFNY]$/;
+    my $val= $class->get_arg($args, "usermsg");
+
+    $class->errors( usermsg => $class->ml('setting.usermessaging.error.invalid'))
+        unless $val=~ /^[MFNY]$/;
+
     return 1;
 }
 
@@ -66,8 +77,11 @@
     my ($class, $u, $args) = @_;
     $class->error_check($u, $args);
 
-    my $opt_usermsg = $class->get_arg($args, "opt_usermsg");
-    return $u->set_prop('opt_usermsg', $opt_usermsg);
+    my $val = $class->get_arg($args, "usermsg");
+
+    $u->set_prop( opt_usermsg => $val );
+
+    return 1;
 }
 
 1;
diff -r 40273080754d -r 86cf3e970e64 htdocs/manage/profile/index.bml
--- a/htdocs/manage/profile/index.bml	Fri Nov 25 22:51:19 2011 +0800
+++ b/htdocs/manage/profile/index.bml	Fri Nov 25 23:02:14 2011 +0800
@@ -42,7 +42,6 @@
 
     # The settings used on this page
     my @settings = ();
-    push @settings, "LJ::Setting::UserMessaging" if LJ::is_enabled('user_messaging');
     push @settings, "LJ::Setting::FindByEmail" if LJ::is_enabled('opt_findbyemail');
     push @settings, "DW::Setting::ProfileEmail";
     push @settings, "DW::Setting::TxtMsgSetup";
@@ -389,11 +388,10 @@
             # opt_usermsg
             if ( LJ::is_enabled( 'user_messaging' ) ) {
                 $ret .= "<tr class='field_block" . $zebra_row->() . "'><td class='field_name'>";
-                $ret .= LJ::Setting::UserMessaging->label;
+                $ret .= BML::ml( 'setting.usermessaging.label', { siteabbrev => $LJ::SITENAMEABBREV } );
                 $ret .= "</td><td><span class='helper'>";
-                $ret .= BML::ml( 'settings.usermessaging.helper', { sitename => $LJ::SITENAMESHORT } );
+                $ret .= BML::ml( 'settings.usermessaging.obsolete' );
                 $ret .= "</span></td>\n<td class='selectvis'>";
-                $ret .= LJ::Setting::UserMessaging->option( $u, undef, { minimal_display => 1, helper => 0 } );
                 $ret .= "</td></tr>\n";
             }
 
@@ -591,10 +589,6 @@
             push @errors, $ML{'.error.day.notinmonth'};
         }
 
-        if ($POST{'LJ__Setting__UserMessaging_opt_usermsg'} && !$POST{'LJ__Setting__UserMessaging_opt_usermsg'} =~ /^[MFNY]$/) {
-            push @errors, $ML{'.error.usermessaging'};
-        }
-
         if ($POST{'LJ__Setting__FindByEmail_opt_findbyemail'} && !$POST{'LJ__Setting__FindByEmail_opt_findbyemail'} =~ /^[HNY]$/) {
             push @errors, $ML{'.error.findbyemail'};
         }
diff -r 40273080754d -r 86cf3e970e64 htdocs/manage/profile/index.bml.text
--- a/htdocs/manage/profile/index.bml.text	Fri Nov 25 22:51:19 2011 +0800
+++ b/htdocs/manage/profile/index.bml.text	Fri Nov 25 23:02:14 2011 +0800
@@ -61,8 +61,6 @@
 
 .error.txt.require_provider=If you're going to use text messaging, you must select your service provider.  If yours isn't listed, please contact us with information about how your service's text messaging feature works so that we can add support for it.
 
-.error.usermessaging=Invalid option for Messaging.
-
 .error.year.notenoughdigits=Invalid birthday year.  Enter a 4-digit year.
 
 .error.year.outofrange=Invalid birthday year.
diff -r 40273080754d -r 86cf3e970e64 htdocs/manage/settings/index.bml
--- a/htdocs/manage/settings/index.bml	Fri Nov 25 22:51:19 2011 +0800
+++ b/htdocs/manage/settings/index.bml	Fri Nov 25 23:02:14 2011 +0800
@@ -126,6 +126,7 @@
             settings => [qw(
                 DW::Setting::EmailAlias
                 DW::Setting::ContactInfo
+                LJ::Setting::UserMessaging
                 LJ::Setting::MinSecurity
                 DW::Setting::SynLevel
                 LJ::Setting::SearchInclusion
--------------------------------------------------------------------------------

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