DM shows player name; add party rename
- ChatGetChannelsHandler: for Direct channels, look up the other member's display name from identity DB and return it as the channel name (per-caller, no DB schema change) - ChatDmOpenHandler: same — returns recipient display name in the DTO for both new and existing DM channels - New ChatPartyRenameHandler (chat.party.rename): updates the party channel name, returns updated DTO - Chat.gd: rename_party() calls the new handler and upserts locally - chat_overlay.gd: "Rename" button in party action bar opens a dialog to set a new party name 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:
@@ -227,6 +227,21 @@ func respond_party_invite(channel_id: String, accept: bool) -> void:
|
||||
)
|
||||
|
||||
|
||||
## Rename the caller's current party channel.
|
||||
func rename_party(name: String) -> void:
|
||||
Network.request(
|
||||
"chat.party.rename",
|
||||
{ "name": name },
|
||||
func(_t: String, p: Variant) -> void:
|
||||
var chan: Dictionary = (p as Dictionary).get("channel", {})
|
||||
if not chan.is_empty():
|
||||
_upsert_channel(chan)
|
||||
party_updated.emit()
|
||||
channels_updated.emit(),
|
||||
func(_c: String, _m: String) -> void: pass
|
||||
)
|
||||
|
||||
|
||||
## Leave the current party channel.
|
||||
func leave_party() -> void:
|
||||
Network.request(
|
||||
|
||||
@@ -471,6 +471,13 @@ func _build_party_tab() -> Control:
|
||||
party_name_lbl.add_theme_color_override("font_color", SOURCE_COLORS["party"])
|
||||
ab_inner.add_child(party_name_lbl)
|
||||
|
||||
var rename_btn := Button.new()
|
||||
rename_btn.text = "Rename"
|
||||
rename_btn.add_theme_font_size_override("font_size", 11)
|
||||
rename_btn.flat = true
|
||||
rename_btn.pressed.connect(_on_party_rename_pressed)
|
||||
ab_inner.add_child(rename_btn)
|
||||
|
||||
var leave_btn := Button.new()
|
||||
leave_btn.text = "Leave"
|
||||
leave_btn.add_theme_color_override("font_color", DANGER_COLOR)
|
||||
@@ -1199,6 +1206,35 @@ func _on_party_invite_received(channel_id: String, inviter_name: String) -> void
|
||||
dialog.queue_free())
|
||||
|
||||
|
||||
func _on_party_rename_pressed() -> void:
|
||||
var party_chan := Chat.get_party_channel()
|
||||
if party_chan.is_empty():
|
||||
return
|
||||
|
||||
var dialog := AcceptDialog.new()
|
||||
dialog.title = "Rename Party"
|
||||
dialog.min_size = Vector2(280, 100)
|
||||
|
||||
var vbox := VBoxContainer.new()
|
||||
vbox.add_theme_constant_override("separation", 8)
|
||||
var input := LineEdit.new()
|
||||
input.placeholder_text = "Party name"
|
||||
input.text = party_chan.get("name", "")
|
||||
input.max_length = 64
|
||||
vbox.add_child(input)
|
||||
dialog.add_child(vbox)
|
||||
|
||||
add_child(dialog)
|
||||
dialog.popup_centered()
|
||||
|
||||
dialog.confirmed.connect(func() -> void:
|
||||
var n := input.text.strip_edges()
|
||||
if not n.is_empty():
|
||||
Chat.rename_party(n)
|
||||
dialog.queue_free())
|
||||
dialog.canceled.connect(func() -> void: dialog.queue_free())
|
||||
|
||||
|
||||
func _on_party_leave_pressed() -> void:
|
||||
Chat.leave_party()
|
||||
if _current_tab == Tab.PARTY:
|
||||
|
||||
Reference in New Issue
Block a user