fix: align group private chat permission semantics

This commit is contained in:
richjohnrambo
2026-09-30 16:11:30 +08:00
parent 99ae6328ff
commit 05b3da55ac
6 changed files with 79 additions and 20 deletions
+14 -1
View File
@@ -3220,13 +3220,26 @@ func (relationsMapper) CanSendP2P(tenantID types.TenantID, userID, peerID types.
return true, types.RelationshipFriend, nil
}
}
ctx, err := (relationsMapper{}).GetRelationshipContext(tenantID, userID, peerID, "")
tenantAdp, err := tenantBusinessAdapter(tenantID)
if err != nil {
return false, "", err
}
ctx, err := relationshipContext(tenantAdp, tenantID, userID, peerID, "")
if err != nil {
return false, "", err
}
if ctx.Relationship == types.RelationshipFriend {
return true, ctx.Relationship, nil
}
if ctx.Relationship == types.RelationshipNone {
shared, err := tenantAdp.TenantUsersShareOpenPrivateGroup(tenantID, userID, peerID)
if err != nil {
return false, ctx.Relationship, err
}
if shared {
return true, ctx.Relationship, nil
}
}
return false, ctx.Relationship, nil
}