fix: align group private chat permission semantics
This commit is contained in:
+14
-1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user