Merge "Revert "Title::checkUserBlock should call User::isBlockedFrom for every action""
[lhc/web/wiklou.git] / includes / CommentStore.php
index 1be7951..cba7a15 100644 (file)
@@ -70,11 +70,7 @@ class CommentStore {
                        'deprecatedIn' => null,
                ],
                'img_description' => [
-                       'table' => 'image_comment_temp',
-                       'pk' => 'imgcomment_name',
-                       'field' => 'imgcomment_description_id',
-                       'joinPK' => 'img_name',
-                       'stage' => MIGRATION_WRITE_NEW,
+                       'stage' => MIGRATION_NEW,
                        'deprecatedIn' => '1.32',
                ],
        ];
@@ -226,8 +222,14 @@ class CommentStore {
                                        if ( $tempTableStage === MIGRATION_OLD ) {
                                                $joinField = "{$alias}.{$t['field']}";
                                        } else {
+                                               // Nothing hits this code path for now, but will in the future when we set
+                                               // $this->tempTables['rev_comment']['stage'] to MIGRATION_WRITE_NEW while
+                                               // merging revision_comment_temp into revision.
+                                               // @codeCoverageIgnoreStart
                                                $joins[$alias][0] = 'LEFT JOIN';
                                                $joinField = "(CASE WHEN {$key}_id != 0 THEN {$key}_id ELSE {$alias}.{$t['field']} END)";
+                                               throw new LogicException( 'Nothing should reach this code path at this time' );
+                                               // @codeCoverageIgnoreEnd
                                        }
                                } else {
                                        $joinField = "{$key}_id";
@@ -349,14 +351,13 @@ class CommentStore {
 
                $msg = null;
                if ( $data !== null ) {
-                       $data = FormatJson::decode( $data );
-                       if ( !is_object( $data ) ) {
+                       $data = FormatJson::decode( $data, true );
+                       if ( !is_array( $data ) ) {
                                // @codeCoverageIgnoreStart
                                wfLogWarning( "Invalid JSON object in comment: $data" );
                                $data = null;
                                // @codeCoverageIgnoreEnd
                        } else {
-                               $data = (array)$data;
                                if ( isset( $data['_message'] ) ) {
                                        $msg = self::decodeMessage( $data['_message'] )
                                                ->setInterfaceMessageFlag( true );