[Rt-commit] rt branch, 4.0/refresh-lang-pref-fix, created. rt-4.0.8-306-g82e95bc

? sunnavy sunnavy at bestpractical.com
Sun Dec 30 09:33:03 EST 2012


The branch, 4.0/refresh-lang-pref-fix has been created
        at  82e95bcd9da3ab7b4deec8096dda536589d0d1d5 (commit)

- Log -----------------------------------------------------------------
commit 8310ae76a7b58c283e70d3c4b1f1e2eee8665eed
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Dec 28 22:05:08 2012 +0800

    initialize LangHandle on each request to make it up to date too

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 3295c0d..6aae7f5 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -266,6 +266,7 @@ sub HandleRequest {
         # make user info up to date
         $HTML::Mason::Commands::session{'CurrentUser'}
           ->Load( $HTML::Mason::Commands::session{'CurrentUser'}->id );
+        undef $HTML::Mason::Commands::session{'CurrentUser'}->{'LangHandle'};
     }
     else {
         $HTML::Mason::Commands::session{'CurrentUser'} = RT::CurrentUser->new();

commit 57a3879de223865b656137f97c18f4e2ffc43f8c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu May 24 02:01:24 2012 +0800

    redirect result page and remove the *unnesessary* LanguageHandle update code in User/Prefs.html
    
    thanks to the redirect(if anything is updated) and we re-initializing
    LanguageHandle on each request, we can make sure the LanguageHandle is always
    up-to-date.

diff --git a/share/html/User/Prefs.html b/share/html/User/Prefs.html
index 5595f23..3220c6b 100644
--- a/share/html/User/Prefs.html
+++ b/share/html/User/Prefs.html
@@ -247,11 +247,6 @@ else {
 
     push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $UserObj );
 
-    if ( $Lang ) {
-        $session{'CurrentUser'}->LanguageHandle($Lang);
-        $session{'CurrentUser'} = $session{'CurrentUser'}; # force writeback
-    }
-
     # Deal with special fields: Privileged, Enabled, and Password
     if  ( $SetPrivileged and $Privileged != $UserObj->Privileged ) {
         my ($code, $msg) = $UserObj->SetPrivileged( $Privileged );
@@ -269,6 +264,11 @@ else {
     }
 }
 
+
+MaybeRedirectForResults(
+    Actions   => \@results,
+);
+
 </%INIT>
 
 

commit 82db49450d4e643ef9ae35750b73729f8bda7921
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Dec 26 23:37:55 2012 -0500

    Add tests for changing language to the default

diff --git a/t/web/user_update.t b/t/web/user_update.t
index d5751ab..5440b84 100644
--- a/t/web/user_update.t
+++ b/t/web/user_update.t
@@ -1,16 +1,14 @@
 use strict;
 use warnings;
 use utf8;
-use RT::Test tests => 9;
+use RT::Test tests => undef;
 
 my ( $url, $m ) = RT::Test->started_ok;
 ok( $m->login(), 'logged in' );
 
 $m->follow_link_ok({text => 'About me'});
-$m->form_with_fields('Lang');
-$m->field(Lang => 'ja');
-$m->submit;
-
+$m->submit_form_ok({ with_fields => { Lang => 'ja'} },
+               "Change to Japanese");
 $m->text_contains("Lang changed from (no value) to 'ja'");
 
 # we only changed one field, and it wasn't the default, so this feedback is
@@ -18,14 +16,24 @@ $m->text_contains("Lang changed from (no value) to 'ja'");
 $m->content_lacks("That is already the current value");
 
 # change back to English
-$m->form_with_fields('Lang');
-$m->field(Lang => 'en_us');
-$m->submit;
+$m->submit_form_ok({ with_fields => { Lang => 'en_us'} },
+               "Change back to english");
 
 # This message shows up in Japanese
 # $m->text_contains("Lang changed from 'ja' to 'en_us'");
 $m->text_contains("Langは「'ja'」から「'en_us'」に変更されました");
 
-# another spurious update
+# Check for a lack of spurious updates
 $m->content_lacks("That is already the current value");
 
+# Ensure that we can change the language back to the default.
+$m->submit_form_ok({ with_fields => { Lang => 'ja'} },
+                   "Back briefly to Japanese");
+$m->text_contains("Lang changed from 'en_us' to 'ja'");
+$m->submit_form_ok({ with_fields => { Lang => ''} },
+                   "And set to the default");
+$m->text_contains("Langは「'ja'」から「''」に変更されました");
+
+undef $m;
+
+done_testing;

commit 82e95bcd9da3ab7b4deec8096dda536589d0d1d5
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 28 12:16:12 2012 -0500

    Add tests to ensure that page language is correct

diff --git a/t/web/user_update.t b/t/web/user_update.t
index 5440b84..f55c773 100644
--- a/t/web/user_update.t
+++ b/t/web/user_update.t
@@ -10,6 +10,7 @@ $m->follow_link_ok({text => 'About me'});
 $m->submit_form_ok({ with_fields => { Lang => 'ja'} },
                "Change to Japanese");
 $m->text_contains("Lang changed from (no value) to 'ja'");
+$m->text_contains("実名", "Page content is japanese");
 
 # we only changed one field, and it wasn't the default, so this feedback is
 # spurious and annoying
@@ -22,6 +23,7 @@ $m->submit_form_ok({ with_fields => { Lang => 'en_us'} },
 # This message shows up in Japanese
 # $m->text_contains("Lang changed from 'ja' to 'en_us'");
 $m->text_contains("Langは「'ja'」から「'en_us'」に変更されました");
+$m->text_contains("Real Name", "Page content is english");
 
 # Check for a lack of spurious updates
 $m->content_lacks("That is already the current value");
@@ -30,9 +32,11 @@ $m->content_lacks("That is already the current value");
 $m->submit_form_ok({ with_fields => { Lang => 'ja'} },
                    "Back briefly to Japanese");
 $m->text_contains("Lang changed from 'en_us' to 'ja'");
+$m->text_contains("実名", "Page content is japanese");
 $m->submit_form_ok({ with_fields => { Lang => ''} },
                    "And set to the default");
 $m->text_contains("Langは「'ja'」から「''」に変更されました");
+$m->text_contains("Real Name", "Page content is english");
 
 undef $m;
 

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


More information about the Rt-commit mailing list