Skip to content

Commit

Permalink
fix empty scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
grigoriev-semyon committed Apr 7, 2024
1 parent 2082487 commit dbce249
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions services_backend/routes/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_buttons(
"required_scopes": button.required_scopes,
"optional_scopes": button.optional_scopes,
}
if scopes:
if view == ButtonView.ACTIVE:
to_add["scopes"] = list(scopes)
result["buttons"].append(to_add)
return result
Expand Down Expand Up @@ -184,7 +184,7 @@ def get_button(
"required_scopes": button.required_scopes,
"optional_scopes": button.optional_scopes,
}
if scopes:
if view == ButtonView.ACTIVE:
result["scopes"] = list(scopes)
return result

Expand Down Expand Up @@ -312,6 +312,6 @@ def get_service(
"required_scopes": button.required_scopes,
"optional_scopes": button.optional_scopes,
}
if scopes:
if view == ButtonView.ACTIVE:
result["scopes"] = list(scopes)
return result
2 changes: 1 addition & 1 deletion services_backend/routes/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_categories(
"order": button.order,
"type": button.type,
"view": view.value,
"scopes": list(scopes) if scopes else None,
"scopes": list(scopes) if view == ButtonView.ACTIVE else None,
"required_scopes": button.required_scopes,
"optional_scopes": button.optional_scopes,
}
Expand Down

0 comments on commit dbce249

Please sign in to comment.