Skip to content

Commit

Permalink
Fix viewing space causing assertion
Browse files Browse the repository at this point in the history
Why:
- _space.creator can be a dictionary or a string id. We must deal with both cases for now.
  • Loading branch information
RevoluPowered committed Mar 26, 2024
1 parent 664c6e6 commit e8ad6e5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions mirror-godot-app/ui/main_menu/pages/view_space.gd
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,19 @@ func populate(space: Dictionary) -> void:
var updated = Time.get_datetime_dict_from_datetime_string(_space.get('updatedAt', ""), false)
_updated_at_label.text = Util.datetime_dict_to_mmm_dd_yyyy(updated)
_url_label.text = _construct_space_url(_space.get("_id", "unknown"))
var creator_promise: Promise = Net.user_client.get_user_profile(_space.creator)
creator_promise.connect_func_to_fulfill(func():
if creator_promise.is_error():
push_error("Failed to get creator")
var data = creator_promise.get_result()
var creator_name = data.get("displayName", tr("Unknown"))

if _space.creator is String:
var creator_promise: Promise = Net.user_client.get_user_profile(_space.creator)
creator_promise.connect_func_to_fulfill(func():
if creator_promise.is_error():
push_error("Failed to get creator")
var data = creator_promise.get_result()
var creator_name = data.get("displayName", tr("Unknown"))
_creator_label.text = tr("Created by {0}").format([creator_name])
)
else:
var creator_name = _space.creator.get("displayName", tr("Unknown"))
_creator_label.text = tr("Created by {0}").format([creator_name])
)
_description_label.text = _preprocess_description(_space.get("description",""))
if _description_label.text == "":
_description_label.text = tr("No description was provided for this space.")
Expand Down

0 comments on commit e8ad6e5

Please sign in to comment.