Merge "build: Enable karma debug log and use progress reporter"
[lhc/web/wiklou.git] / includes / specials / SpecialEditTags.php
index d2b2e70..916ba6b 100644 (file)
@@ -55,6 +55,10 @@ class SpecialEditTags extends UnlistedSpecialPage {
                parent::__construct( 'EditTags', 'changetags' );
        }
 
+       public function doesWrites() {
+               return true;
+       }
+
        public function execute( $par ) {
                $this->checkPermissions();
                $this->checkReadOnly();
@@ -63,6 +67,11 @@ class SpecialEditTags extends UnlistedSpecialPage {
                $user = $this->getUser();
                $request = $this->getRequest();
 
+               // Check blocks
+               if ( $user->isBlocked() ) {
+                       throw new UserBlockedError( $user->getBlock() );
+               }
+
                $this->setHeaders();
                $this->outputHeader();
 
@@ -275,6 +284,7 @@ class SpecialEditTags extends UnlistedSpecialPage {
        protected function buildCheckBoxes() {
                // If there is just one item, provide the user with a multi-select field
                $list = $this->getList();
+               $tags = array();
                if ( $list->length() == 1 ) {
                        $list->reset();
                        $tags = $list->current()->getTags();
@@ -295,14 +305,9 @@ class SpecialEditTags extends UnlistedSpecialPage {
                        $html .= '</td></tr>';
                        $tagSelect = $this->getTagSelect( $tags, $this->msg( 'tags-edit-new-tags' )->plain() );
                        $html .= '<tr><td>' . $tagSelect[0] . '</td><td>' . $tagSelect[1];
-                       // also output the tags currently applied as a hidden form field, so we
-                       // know what to remove from the revision/log entry when the form is submitted
-                       $html .= Html::hidden( 'wpExistingTags', implode( ',', $tags ) );
-                       $html .= '</td></tr></table>';
                } else {
                        // Otherwise, use a multi-select field for adding tags, and a list of
                        // checkboxes for removing them
-                       $tags = array();
 
                        // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
                        for ( $list->reset(); $list->current(); $list->next() ) {
@@ -328,9 +333,13 @@ class SpecialEditTags extends UnlistedSpecialPage {
                                                'class' => 'mw-edittags-remove-checkbox',
                                        ) );
                        }
-                       $html .= '</td></tr></table>';
                }
 
+               // also output the tags currently applied as a hidden form field, so we
+               // know what to remove from the revision/log entry when the form is submitted
+               $html .= Html::hidden( 'wpExistingTags', implode( ',', $tags ) );
+               $html .= '</td></tr></table>';
+
                return $html;
        }