feat: add client call feature switches
This commit is contained in:
+9
-4
@@ -1712,6 +1712,7 @@ func serveIMBootstrap(wrt http.ResponseWriter, req *http.Request) {
|
||||
writeIMRelationError(wrt, req, err)
|
||||
return
|
||||
}
|
||||
audioCallEnabled, videoCallEnabled := imCallFeatureFlags()
|
||||
writeIMSuccess(wrt, req, map[string]any{
|
||||
"features": map[string]any{
|
||||
"create_group": true,
|
||||
@@ -1721,11 +1722,15 @@ func serveIMBootstrap(wrt http.ResponseWriter, req *http.Request) {
|
||||
"attendance": true,
|
||||
"message_recall": true,
|
||||
"message_edit": true,
|
||||
"audio_call": audioCallEnabled,
|
||||
"video_call": videoCallEnabled,
|
||||
},
|
||||
"permissions": map[string]any{
|
||||
"create_group": true,
|
||||
"user_search": true,
|
||||
"scan_qr": true,
|
||||
"audio_call": audioCallEnabled,
|
||||
"video_call": videoCallEnabled,
|
||||
},
|
||||
"entry_badges": entryBadges,
|
||||
"entries": entries,
|
||||
@@ -6913,7 +6918,7 @@ func groupMemberProfilePayload(topic string, sub *types.Subscription, user *type
|
||||
data["relationship"] = ctx.Relationship
|
||||
data["capabilities"] = map[string]any{
|
||||
"can_send": ctx.CanSend,
|
||||
"can_call": ctx.CanSend,
|
||||
"can_call": imCanCall(ctx.CanSend),
|
||||
"can_add_friend": ctx.Relationship == types.RelationshipNone,
|
||||
}
|
||||
if ctx.RequestID != "" {
|
||||
@@ -8447,7 +8452,7 @@ func relationshipContextPayload(ctx *types.RelationshipContext) map[string]any {
|
||||
"can_send_text": ctx.CanSend,
|
||||
"can_send_media": ctx.CanSend,
|
||||
"can_send_card": ctx.CanSend,
|
||||
"can_call": ctx.CanSend,
|
||||
"can_call": imCanCall(ctx.CanSend),
|
||||
"can_add_friend": ctx.Relationship == types.RelationshipNone,
|
||||
"can_handle_request": ctx.Relationship == types.RelationshipPendingInbound,
|
||||
},
|
||||
@@ -8506,7 +8511,7 @@ func friendListItemPayload(item types.FriendListItem) map[string]any {
|
||||
"online_visibility": "unknown",
|
||||
"created_at": item.Friendship.CreatedAt.UTC().Format(time.RFC3339Nano),
|
||||
"updated_at": item.Friendship.UpdatedAt.UTC().Format(time.RFC3339Nano),
|
||||
"capabilities": map[string]any{"can_send": item.Friendship.Status == types.RelationshipFriend, "can_call": item.Friendship.Status == types.RelationshipFriend},
|
||||
"capabilities": map[string]any{"can_send": item.Friendship.Status == types.RelationshipFriend, "can_call": imCanCall(item.Friendship.Status == types.RelationshipFriend)},
|
||||
"display_name_source": "profile",
|
||||
}
|
||||
if item.Friendship.Remark != "" {
|
||||
@@ -8572,7 +8577,7 @@ func userProfilePayload(user *types.User, ctx *types.RelationshipContext) map[st
|
||||
data["topic"] = ctx.Topic
|
||||
data["capabilities"] = map[string]any{
|
||||
"can_send": ctx.CanSend,
|
||||
"can_call": ctx.CanSend,
|
||||
"can_call": imCanCall(ctx.CanSend),
|
||||
"can_add_friend": ctx.Relationship == types.RelationshipNone,
|
||||
}
|
||||
if ctx.RequestID != "" {
|
||||
|
||||
Reference in New Issue
Block a user