WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/21/2016 10:55:33 PM (4 years ago)
Author:
rachelbaker
Message:

REST API: Set the comment type to a readonly property in the schema.

Document the type property as readonly and remove the default value. After #38820 it is no longer possible to set the type property on a comment to anything a custom type.

Props jnylen0, rachelbaker.
Fixes #38886.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php

    r39327 r39337  
    23312331        $this->assertArrayHasKey( 'status', $properties );
    23322332        $this->assertArrayHasKey( 'type', $properties );
    2333         $this->assertEquals( 'comment', $properties['type']['default'] );
    23342333
    23352334        $this->assertEquals( 0, $properties['parent']['default'] );
    23362335        $this->assertEquals( 0, $properties['post']['default'] );
     2336
     2337        $this->assertEquals( true, $properties['link']['readonly'] );
     2338        $this->assertEquals( true, $properties['type']['readonly'] );
    23372339    }
    23382340
Note: See TracChangeset for help on using the changeset viewer.