Review main Merged

71451[BUGFIX] Fix invalid json responses for empty page trees

Benjamin Franzke CR +2 V +2 Normal +57 −58 updated 10/07/21, 08:30

Commit message

JsonResponse class constructor needs to encode empty
arrays for [] to be returned as response, instead of an
empty string.

An empty string is invalid json and therefore causes frontend
error handlers like "Page tree error" to be triggered,
while there is no error if the list of available pages is empty
for an editor – it is just empty, no error happened.

Previously (new JsonResponse)->setPayload($array) has been used
to circumvent this bug in the JsonResponse construtor in order
to be able to send empty arrays as response.
These cases are now adapted to use the constructor, now that
it is working as expected.

Also adapt to use strict typing and remove unneeded runtime
resource checks while at it. JsonResponse is internal API,
therefore this is not considered breaking.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 16