[dw-free] More informative error message when maximum tags is reached
[commit: http://hg.dwscoalition.org/dw-free/rev/af4fb7de068f]
http://bugs.dwscoalition.org/show_bug.cgi?id=3278
Instead of telling us that we've exceeded the maximum number of tags, state
how many extra we have, and list the new tags on this entry.
Patch by Erin of
teamdestroyer.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3278
Instead of telling us that we've exceeded the maximum number of tags, state
how many extra we have, and list the new tags on this entry.
Patch by Erin of
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- bin/upgrading/en.dat
- cgi-bin/LJ/Tags.pm
-------------------------------------------------------------------------------- diff -r aa7e846f2689 -r af4fb7de068f bin/upgrading/en.dat --- a/bin/upgrading/en.dat Fri Dec 17 01:04:29 2010 +0800 +++ b/bin/upgrading/en.dat Fri Dec 17 01:20:43 2010 +0800 @@ -3786,7 +3786,7 @@ taglib.error.mergenoname=You did not pro taglib.error.mergetoexisting=The tag name '[[tagname]]' is already in use, but you did not select it. Please select the tag or merge to a different tag name. -taglib.error.toomany=This would make you exceed your maximum of [[max]] tags. Please remove some and try again. +taglib.error.toomany=This would make you exceed your maximum of [[max]] tags. Please remove at least [[excess]] of the following new tags: [[tags]]. talk.anonwrote=Someone wrote, diff -r aa7e846f2689 -r af4fb7de068f cgi-bin/LJ/Tags.pm --- a/cgi-bin/LJ/Tags.pm Fri Dec 17 01:04:29 2010 +0800 +++ b/cgi-bin/LJ/Tags.pm Fri Dec 17 01:20:43 2010 +0800 @@ -833,7 +833,11 @@ sub update_logtags { my $max = $opts->{ignore_max} ? 0 : $u->count_tags_max; if (@to_create && $max && $max > 0) { my $total = scalar(keys %$utags) + scalar(@to_create); - return $err->(LJ::Lang::ml('taglib.error.toomany', { max => $max })) if $total > $max; + if ( $total > $max ) { + return $err->(LJ::Lang::ml('taglib.error.toomany', { max => $max, + tags => join(", ", @to_create), + excess => $total - $max })); + } } # now we can create the new tags, since we know we're safe @@ -1102,8 +1106,12 @@ sub create_usertag { my $max = $opts->{ignore_max} ? 0 : $u->count_tags_max; if ($max && $max > 0) { my $cur = scalar(keys %{ LJ::Tags::get_usertags($u) || {} }); - return $err->(LJ::Lang::ml('taglib.error.toomany', { max => $max })) - if $cur + scalar(@$tags) > $max; + my $tagtotal = $cur + scalar(@$tags); + if ($tagtotal > $max) { + return $err->(LJ::Lang::ml('taglib.error.toomany', { max => $max, + tags => join(", ", @$tags) , + excess => $tagtotal - $max })); + } } my $display = $opts->{display} ? 1 : 0; --------------------------------------------------------------------------------