Skip to content

Commit

Permalink
Update button.py
Browse files Browse the repository at this point in the history
removed adding link field by default and added the needed condition
  • Loading branch information
Zimovchik committed Jul 9, 2024
1 parent 96acb7b commit c536e01
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions services_backend/routes/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def get_buttons(
"id": button.id,
"icon": button.icon,
"name": button.name,
"link": button.link,
"order": button.order,
"type": button.type,
"view": view.value,
Expand All @@ -138,7 +137,10 @@ def get_buttons(
}
if view == ButtonView.ACTIVE:
to_add["scopes"] = list(scopes)
if user_scopes.issuperset(button.required_scopes):
to_add["link"] = button.link
result["buttons"].append(to_add)

return result


Expand Down Expand Up @@ -177,7 +179,6 @@ def get_button(
"id": button.id,
"icon": button.icon,
"name": button.name,
"link": button.link,
"order": button.order,
"type": button.type,
"view": view.value,
Expand All @@ -186,6 +187,8 @@ def get_button(
}
if view == ButtonView.ACTIVE:
result["scopes"] = list(scopes)
if user_scopes.issuperset(button.required_scopes):
result["link"] = button.link
return result


Expand Down

0 comments on commit c536e01

Please sign in to comment.