Encapsulate valid label fetching to `FlaggableElement`
Closes #584
This creates a new api route /api/valid_labels that returns the list of valid labels that can apply to any message.
FlaggableElement is updated to dynamically fetch labels from the new route and cache them. This allows FlaggableElement to be used anywhere without needing to pipe in the valid labels from call sites. This still calls the api route once per page load.
Blocking on #590 before marking ready for review so I can merge.
I see code 422 (unprocessable entity) responses when submitting the label report on the rank pages, is this expected? Also I get the same on the labeling pages (but I'm not sure is we are planning to have the flags there).
Good catch, I didn't catch that. Fixed now
Posted #614 as a future cleanup around messages. The types are pretty confusing and different depending on use case.