Fix Channels: allow moving the fallback region whatever the item order

Merged
ND
4d ago
+77-14

Fixes #11204

Replacing a channel's regions failed with a unique constraint error when the new fallback region was listed before the current one, because the members were saved in request order and the old fallback still held the flag. The replacement now saves the fallback member after all the others, so the previous holder is demoted first, the same order setDefaultRegion already uses. Validation, refusals, the single transaction and the fallback-first response stay as they were.


Summary by cubic

Fixes replacing a channel's region set failing with a unique constraint error when the new fallback region was listed before the current one. The fallback region is now written after all other members, so the previous holder is demoted first, the same order setDefaultRegion already uses. Validation, refusals, the single transaction, and the fallback-first response are unchanged; member saving was extracted into a private saveMember method, with a regression test covering moving the fallback flag to an earlier member.