From bfc8d742b028c2a484c43fb2bf661b9b82fafb64 Mon Sep 17 00:00:00 2001 From: wvffle Date: Sun, 25 Sep 2022 16:31:26 +0000 Subject: [PATCH] Dynamically fix `get_radio_radio_track` --- api/funkwhale_api/schema.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/api/funkwhale_api/schema.py b/api/funkwhale_api/schema.py index 14f2dc914..2f6892f4f 100644 --- a/api/funkwhale_api/schema.py +++ b/api/funkwhale_api/schema.py @@ -47,16 +47,12 @@ class CustomAutoSchema(AutoSchema): if len(tokenized_path) > 0 and model_singular == tokenized_path[0]: tokenized_path.pop(0) - # rename `get_radio_radio_track` to `get_radio_track` - if ( - len(tokenized_path) > 1 - and tokenized_path[0] == "radio" - and tokenized_path[1] == "radio" - ): + # rename `get_radio_radio_track` to `get_radio_track`. Works with all models + if len(tokenized_path) > 1 and tokenized_path[0] == tokenized_path[1]: tokenized_path.pop(0) # rename `get_manage_channel` to `admin_get_channel` - elif len(tokenized_path) > 0 and tokenized_path[0] == "manage": + if len(tokenized_path) > 0 and tokenized_path[0] == "manage": tokenized_path.pop(0) # rename `get_manage_library_album` to `admin_get_album`