fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-06-09 05:23 pm

[dw-free] Poster + maint option makes no sense for tags control

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

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

* Don't show poster + maint option for tags control. It makes sense only for
adding tags to the entry.
* Don't change the tags permissions if there was an error

Patch by [personal profile] fu.

(Edited subject -- had input the wrong bug number)

Files modified:
  • htdocs/manage/tags.bml
--------------------------------------------------------------------------------
diff -r 15d34a83ff84 -r ca48892d3115 htdocs/manage/tags.bml
--- a/htdocs/manage/tags.bml	Wed Jun 09 17:19:36 2010 +0000
+++ b/htdocs/manage/tags.bml	Thu Jun 10 01:29:08 2010 +0800
@@ -112,11 +112,13 @@ HEAD
             my $add = $POST{"add_level"};
             my $control = $POST{"control_level"};
 
-            $ret .= "<?errorbar $ML{'.error.invalidsettings'} errorbar?>"
-               unless $add =~ /^(?:private|public|protected|author_admin|group:\d+)$/ &&
-               $control =~ /^(?:private|public|protected|group:\d+)$/;
+            if ( $add =~ /^(?:private|public|protected|author_admin|group:\d+)$/
+                && $control =~ /^(?:private|public|protected|group:\d+)$/ ) {
 
-            $u->set_prop("opt_tagpermissions", "$add,$control");
+                $u->set_prop("opt_tagpermissions", "$add,$control");
+            } else {
+                $ret .= "<?errorbar $ML{'.error.invalidsettings'} errorbar?>";
+            }
         }
     }
 
@@ -342,30 +344,35 @@ HEAD
     $ret .= '<tr><td colspan="2"><br /><fieldset><legend>' . $ML{'.label.settings'}. '</legend>';
     $ret .= '<div style="padding-top: 6px;">';
 
-    my @groups = ("public", $ML{'.setting.public'});
+    my @control_groups = ("public", $ML{'.setting.public'});
 
     if ($u->is_person) {
-        push @groups, ("protected", $ML{'.setting.trusted'});
-        push @groups, ("private", $ML{'.setting.private'});
+        push @control_groups, ("protected", $ML{'.setting.trusted'});
+        push @control_groups, ("private", $ML{'.setting.private'});
     } else {
-        push @groups, ("protected", $ML{'.setting.members'});
-        push @groups, ("private", $ML{'.setting.maintainers'});
-
-        push @groups, ( "author_admin", $ML{'.setting.author_admin'} )
-            if $u->is_community;
+        push @control_groups, ("protected", $ML{'.setting.members'});
+        push @control_groups, ("private", $ML{'.setting.maintainers'});
     }
 
+    my @add_groups = @control_groups;
+    push @add_groups, ( "author_admin", $ML{'.setting.author_admin'} )
+        if $u->is_community;
+
     my @grouplist = $u->trust_groups;
-    push @groups, map { "group:" . $_->{groupnum}, $_->{groupname} } @grouplist;
+    my @custom_groups;
+    push @custom_groups, map { "group:" . $_->{groupnum}, $_->{groupname} } @grouplist;
+
+    push @control_groups, @custom_groups;
+    push @add_groups, @custom_groups;
 
     my $security = LJ::Tags::get_permission_levels($u);
 
     $ret .= "<div class='tagsec'> "
-        . LJ::html_select({ name => 'control_level', selected => $security->{control} }, @groups)
+        . LJ::html_select({ name => 'control_level', selected => $security->{control} }, @control_groups)
         . " $ML{'.setting.desc.control'} </div>";
 
     $ret .= "<div class='tagsec'>"
-            . LJ::html_select({ name => 'add_level', selected => $security->{add} }, @groups)
+            . LJ::html_select({ name => 'add_level', selected => $security->{add} }, @add_groups)
             . " $ML{'.setting.desc.add'} </div>";
 
     $ret .= "<div align='center'>";
--------------------------------------------------------------------------------
ninetydegrees: Text: let's make better mistakes tomorrow. (mistakes)

[personal profile] ninetydegrees 2010-06-09 05:35 pm (UTC)(link)
Unrelated to this particularly bug but related to this new feature: the text of the drop-down menu for this option says: entry author and admininstrators. One n too many.

Maybe you can fix this on the fly. I'll report it otherwise.
Edited 2010-06-09 17:35 (UTC)