vanilla / addons

Official add-ons and tools for Vanilla Forums.
http://open.vanillaforums.com
108 stars 169 forks source link

Fix discussion API failure when no question status is set #798

Closed danni-stark closed 4 years ago

danni-stark commented 4 years ago

closes https://github.com/vanilla/support/issues/1699

Details

Making an api/v2/discussions call When a Discussion of Type question and QnA Null would fail with this error

"message": "Validation Failed",

"status": 422,

"errors": [

    {

        "field": "status",

        "code": "missingField",

        "path": "[22].attributes.question",

        "status": 422,

        "message": "item[22].attributes.question.status is required."

    }

]

This is happening because of https://github.com/vanilla/addons/blob/master/plugins/QnA/class.qna.plugin.php#L1320 w'ere not setting a default value when that field is null.