[Rt-commit] rt branch, 4.0/terse-textarea-updates, created. rt-4.0.5-81-gd24effb
Alex Vandiver
alexmv at bestpractical.com
Fri Mar 9 18:40:16 EST 2012
The branch, 4.0/terse-textarea-updates has been created
at d24effb1afc31a6afc7c5924bdce3873c37169c0 (commit)
- Log -----------------------------------------------------------------
commit d24effb1afc31a6afc7c5924bdce3873c37169c0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Mar 9 18:35:52 2012 -0500
When updating "text" fields "text", don't display old and new values
Fields which are stored as "text", such as the content of templates, or
custom actions or conditions on scrips, do not benefit from displaying
"xxx changed from yyy to zzz", as yyy and zzz are generally long
multi-line blocks of text, whose newlines are stripped during HTML
rendering.
Update the message to simply say the more concise "xxx updated", which
is already a locstring in use elsewhere in RT.
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 29cff47..429ff7c 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -500,19 +500,24 @@ sub _Set {
# $ret is a Class::ReturnValue object. as such, in a boolean context, it's a bool
# we want to change the standard "success" message
if ($status) {
- $msg =
- $self->loc(
- "[_1] changed from [_2] to [_3]",
- $self->loc( $args{'Field'} ),
- ( $old_val ? '"' . $old_val . '"' : $self->loc("(no value)") ),
- '"' . $self->__Value( $args{'Field'}) . '"'
- );
- } else {
-
- $msg = $self->CurrentUser->loc_fuzzy($msg);
+ if ($self->SQLType( $args{'Field'}) =~ /text/) {
+ $msg = $self->loc(
+ "[_1] updated",
+ $self->loc( $args{'Field'} ),
+ );
+ } else {
+ $msg = $self->loc(
+ "[_1] changed from [_2] to [_3]",
+ $self->loc( $args{'Field'} ),
+ ( $old_val ? '"' . $old_val . '"' : $self->loc("(no value)") ),
+ '"' . $self->__Value( $args{'Field'}) . '"',
+ );
+ }
+ } else {
+ $msg = $self->CurrentUser->loc_fuzzy($msg);
}
- return wantarray ? ($status, $msg) : $ret;
+ return wantarray ? ($status, $msg) : $ret;
}
diff --git a/t/web/html_template.t b/t/web/html_template.t
index 662a26b..81e828e 100644
--- a/t/web/html_template.t
+++ b/t/web/html_template.t
@@ -32,7 +32,7 @@ Content-Type: text/html
EOF
},
);
- $m->content_like( qr/Content changed/, 'content is changed' );
+ $m->content_like( qr/Content updated/, 'content is changed' );
$m->content_contains( 'ä½ å¥½', 'content is really updated' );
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list