Feat v0.5.2 chat surface (#32)
All checks were successful
All checks were successful
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #32.
This commit is contained in:
@@ -66,7 +66,7 @@ def _now():
|
||||
# Exported API (lib.require("chat-core"))
|
||||
# ═══════════════════════════════════════════════
|
||||
|
||||
def create(title, type="group", participants=None, creator_id=""):
|
||||
def create(title, type="group", participants=None, creator_id="", creator_display_name=""):
|
||||
"""Create a conversation and add initial participants.
|
||||
|
||||
Args:
|
||||
@@ -74,6 +74,7 @@ def create(title, type="group", participants=None, creator_id=""):
|
||||
type: "direct" or "group" (default "group")
|
||||
participants: list of dicts with {id, type?, display_name?, role?}
|
||||
creator_id: user ID of the creator (added as admin)
|
||||
creator_display_name: display name of the creator
|
||||
|
||||
Returns:
|
||||
dict with conversation data
|
||||
@@ -95,7 +96,7 @@ def create(title, type="group", participants=None, creator_id=""):
|
||||
"conversation_id": cid,
|
||||
"participant_id": _str(creator_id),
|
||||
"participant_type": "user",
|
||||
"display_name": "",
|
||||
"display_name": _str(creator_display_name),
|
||||
"role": "admin",
|
||||
"joined_at": "",
|
||||
})
|
||||
@@ -430,8 +431,9 @@ def _handle_create_conversation(req, user_id):
|
||||
title = _str(body.get("title", ""))
|
||||
conv_type = _str(body.get("type", "group"))
|
||||
participants_list = body.get("participants", [])
|
||||
creator_name = _str(body.get("creator_display_name", ""))
|
||||
|
||||
conv = create(title, conv_type, participants_list, user_id)
|
||||
conv = create(title, conv_type, participants_list, user_id, creator_name)
|
||||
return _resp(201, conv)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user