Merge "Add parameter to API modules to apply change tags to log entries"
[lhc/web/wiklou.git] / includes / specials / SpecialBlock.php
index 585f70b..82f7d08 100644 (file)
@@ -127,7 +127,15 @@ class SpecialBlock extends FormSpecialPage {
         */
        protected function getFormFields() {
                global $wgBlockAllowsUTEdit;
-
+               if ( !wfMessage( 'ipbreason-dropdown' )->inContentLanguage()->isDisabled() ) {
+                       $reasonsList = Xml::getArrayFromWikiTextList(
+                               wfMessage( 'ipbreason-dropdown' )->inContentLanguage()->text()
+                       );
+                       $this->getOutput()->addModules( 'mediawiki.reasonSuggest' );
+                       $this->getOutput()->addJsConfigVars( [
+                               'reasons' => $reasonsList
+                       ] );
+               }
                $user = $this->getUser();
 
                $suggestedDurations = self::getSuggestedDurations();
@@ -828,9 +836,13 @@ class SpecialBlock extends FormSpecialPage {
                $blockIds = array_merge( [ $status['id'] ], $status['autoIds'] );
                $logEntry->setRelations( [ 'ipb_id' => $blockIds ] );
                $logId = $logEntry->insert();
+
+               if ( count( $data['Tags'] ) ) {
+                       $logEntry->setTags( $data['Tags'] );
+               }
+
                $logEntry->publish( $logId );
 
-               # Report to the user
                return true;
        }