Set friend request permissions
Configure approval policies for incoming friend requests directed to the authenticated user.
The addFriendPermission property configures whether other users can add the current account directly, require approval, or are blocked from sending friend requests. This account-level setting is a commercial feature and should be configured through a dedicated privacy preference interface.
Parameters
The addFriendPermission parameter accepts values of type OpenIMAddFriendPermission:
| Enum constant | Numeric value | Description |
|---|---|---|
OpenIMAddFriendPermissionAllowed | 0 | Other users may submit friend requests, which require manual review by the current user. |
OpenIMAddFriendPermissionAllowedNoReview | 1 | Other users can add this account as a friend immediately without manual approval. |
OpenIMAddFriendPermissionDenied | 2 | Other users are blocked from submitting friend requests to this account. |
Code example
import {
OpenIMAddFriendPermissionAllowed,
setSelfInfo,
} from '@/uni_modules/unix-openim-sdk'
await setSelfInfo({
addFriendPermission: OpenIMAddFriendPermissionAllowed,
})This configuration applies exclusively to subsequent friend requests. It does not alter existing friendships or auto-accept, reject, or purge pending friend applications.
Return value
The Promise resolves with void once OpenIMServer updates the account permission.
State changes after the call
A resolved Promise confirms that the policy has been updated on OpenIMServer. It does not mean the user profile update event has finished propagating to other active clients. For event registration and userID cache updating, see Update your profile. To verify the active policy immediately, invoke Get your profile and inspect addFriendPermission.
Was this page helpful?