Unblock a user
If you are the website owner, you can unblock users by removing their signing key from the appendable data associated with the current page.
- Deserialize the signing key
- Remove the signing key from the filter
- Save the appendable data
- Update the structured data for blocked users
- Drop the handle for the signing key
When you select a user to unblock, the plugin is able to retrieve the serialized signing key of that user from the list of blocked users.
Deserialize the signing key
The plugin deserializes the signing key of the user you want to unblock.
window.safeSignKey.deserialise(this._authToken, new Buffer(this._data.blockedUsers[userName], 'base64'))
The API returns the handle ID for the signing key.
Remove the signing key from the filter
The plugin removes the signing key of the user you want to unblock from the appendable data associated with the current page.
window.safeAppendableData.removeFromFilter( this._authToken, this._currentPostHandleId, [signKeyHandle])
Save the appendable data
The plugin updates the appendable data associated with the current page by sending a POST request to the SAFE Network.
window.safeAppendableData.post( this._authToken, this._currentPostHandleId)
Update the structured data for blocked users
The plugin removes the serialized signing key of the user you just unblocked from the list of blocked users for the current page.
delete this._data.blockedUsers[userName] const data = new Buffer(JSON.stringify(this._data.blockedUsers)).toString('base64')
Update the structured data
The plugin updates the structured data with the new list of blocked users.
window.safeStructuredData.updateData( this._authToken, this._blockedUserStructureDataHandle, data, this._symmetricCipherOptsHandle)
Save the structured data
The plugin saves the structured data by sending a POST request to the SAFE Network.
window.safeStructuredData.post( this._authToken, this._blockedUserStructureDataHandle)
Drop the handle for the signing key
The plugin drops the handle that represents the signing key of the user you just unblocked.
After the user has been unblocked, the plugin reloads the comments.