[Rt-commit] rt branch, 4.0/refresh-lang-pref-fix, updated. rt-4.0.6-128-g835b689
Alex Vandiver
alexmv at bestpractical.com
Wed Dec 26 23:38:02 EST 2012
The branch, 4.0/refresh-lang-pref-fix has been updated
via 835b689c3b49ac09f8cffc5f229f46edb5ac1db8 (commit)
via 543399d08823891aa4688975d523425e1f42f200 (commit)
from 27fffe498e0d10af697c18081acde475a9e0b738 (commit)
Summary of changes:
share/html/User/Prefs.html | 6 ++++--
t/web/user_update.t | 26 +++++++++++++++++---------
2 files changed, 21 insertions(+), 11 deletions(-)
- Log -----------------------------------------------------------------
commit 543399d08823891aa4688975d523425e1f42f200
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Dec 26 23:30:59 2012 -0500
Update language preference if it is submitted
Passing undef to ->LanguageHandle, as now happens upon loading the uer
preferences page, generates warnings from I18M::LangTags. Solve the
original problem, but avoid the warnings, by checking the defined-ness
of $Lang, not simply its truth.
diff --git a/share/html/User/Prefs.html b/share/html/User/Prefs.html
index 00c4a3a..fd38886 100755
--- a/share/html/User/Prefs.html
+++ b/share/html/User/Prefs.html
@@ -238,8 +238,10 @@ else {
push @results, ProcessObjectCustomFieldUpdates( ARGSRef => \%ARGS, Object => $UserObj );
- $session{'CurrentUser'}->LanguageHandle($Lang);
- $session{'CurrentUser'} = $session{'CurrentUser'}; # force writeback
+ if ( defined $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 ) {
commit 835b689c3b49ac09f8cffc5f229f46edb5ac1db8
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 dc908fc..6724bc4 100644
--- a/t/web/user_update.t
+++ b/t/web/user_update.t
@@ -2,16 +2,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
@@ -19,14 +17,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;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list