Fix chat bubble visibility, friends refresh, and DM close

- Chat bubble now hidden on all scenes; MainScreen shows/hides it via
  Chat.set_bubble_visible() in _ready/_exit_tree
- send_friend_request now uses Network.request so _fetch_social() fires
  on success, making the friends list update immediately after adding
- Added DM close button (✕) to each conversation row in the DMs tab;
  _close_dm removes the channel from local state via Chat.close_dm()

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-06 22:14:43 -05:00
co-authored by Claude Happy
parent a482cc5319
commit dceabf4f06
8 changed files with 55 additions and 4 deletions
+21 -3
View File
@@ -92,8 +92,7 @@ func _add_overlay() -> void:
# ── Auth hooks ────────────────────────────────────────────────────────────────
func _on_auth_success(_uid: String, _dn: String) -> void:
if is_instance_valid(_overlay):
_overlay.visible = true
# Overlay visibility is controlled by individual scenes via set_bubble_visible().
_fetch_social()
_fetch_channels()
_fetch_notifications()
@@ -101,6 +100,13 @@ func _on_auth_success(_uid: String, _dn: String) -> void:
_start_message_polling()
## Show or hide the chat bubble overlay. Call from scenes that want chat
## (e.g. MainScreen._ready / _exit_tree).
func set_bubble_visible(v: bool) -> void:
if is_instance_valid(_overlay):
_overlay.visible = v
func _clear_state() -> void:
if is_instance_valid(_overlay):
_overlay.visible = false
@@ -147,7 +153,11 @@ func open_dm(recipient_account_id: String) -> void:
func send_friend_request(recipient_id: String) -> void:
Network.send("chat.friend_request", { "recipientAccountId": recipient_id })
Network.request("chat.friend_request",
{ "recipientAccountId": recipient_id },
func(_t: String, _p: Variant) -> void: _fetch_social(),
func(_c: String, _m: String) -> void: pass
)
func respond_friend_request(request_id: String, accept: bool) -> void:
@@ -265,6 +275,14 @@ func get_party_channel() -> Dictionary:
return c
return {}
## Remove a Direct channel from local state (client-side only, no server call).
func close_dm(channel_id: String) -> void:
channels = channels.filter(func(c: Dictionary) -> bool:
return c.get("id", "") != channel_id)
messages.erase(channel_id)
channels_updated.emit()
# ── Private helpers ───────────────────────────────────────────────────────────
func _set_own_presence(status: String) -> void:
@@ -0,0 +1 @@
uid://crug2fpja5h1q