User Profile Moderation

Sometimes users are not comfortable, or are being harassed by another user. In order to help users to keep themselves safe, they can block others from engaging with them in certain ways.

What blocking a profile does?

When Profile A blocks Profile B:

  • Profile A doesn't not see any messages send by Profile B.
  • Prevent Profile B from inviting Profile A to chat rooms.
  • Prevent Profile B from adding Profile A to chat rooms.

Block a Profile

Use this method to block a user profile for the given profileId

LiveLike.blockProfile({
    profileId: "<Profile ID>"
})
.then(blockInfo => console.log(blockInfo))

Unblocking a Profile

Use this method to unblock profile using Block Info id for a given blocked profile, use getProfileBlockInfo or getBlockInfoList to get corresponding profile block info id

LiveLike.unblockProfile({
    blockId: "<Block ID>"
 })
.then(response => console.log(response))

Getting a List of Blocked Profile Info

Using this method you can get a list of all the profiles blocked by the current user.
It returns a Promise that resolves in paginated list of Block Info objects.

LiveLike.getBlockInfoList()
	.then(paginatedBlockInfo => console.log(paginatedBlockInfo))

Getting a List of Blocked Profile Ids

Use this method to get a list of blocked profile ids, could be used to filter chat messages by blocked profile.

LiveLike.getBlockedProfileIds().then(profileIds => console.log(profileIds))

Getting blocked profile Info

Use this method to get block information for a particular profile Id.

LiveLike.getProfileBlockInfo({
    profileId: "<Profile ID>"
})
.then(blockInfo => console.log(blockInfo))

Block Profile Events

You can use addUserProfileEventListener and removeUserProfileEventListener to attach and remove listener function for block profile events respectively. This events are exposed as part of UserProfileEvent from javascript package

Event NameDescription
BLOCK_PROFILETriggered when a given profile is blocked
UNBLOCK_PROFILETriggered when a given profile is unblocked
import { addUserProfileEventListener, UserProfileEvent } from '@livelike/javascript'

function onUserProfileBlockCb(event){
  // process block event
}
addUserProfileEventListener(UserProfileEvent.BLOCK_PROFILE, onUserProfileBlockCb)


What’s Next