Edit a comment
You can only edit your comments if the current page is using the Editable Comments Plugin.
Since comments are saved using versioned structured data (type 501), everyone will be able to see old comments by browsing the comment history.
Contents


Get the comment from the appendable data
The plugin fetches a data identifier handle for the comment you want to edit.
GET /appendable-data/:handleId/:index
window.safeAppendableData.getDataIdAt(
this._authToken, this._currentPostHandleId, index)
Get a structured data handle
The plugin fetches a structured data handle using the data identifier handle previously obtained.
GET /structured-data/handle/:dataIdHandle
window.safeStructuredData.getHandle(this._authToken, address)
Update the structured data
The plugin updates the structured data handle with the new version of the comment.
const payload = new Buffer(JSON.stringify({
name: original.name,
comment: newText,
time: original.time, // we keep the original time so the order stays intact
editedTime: (new Date()).getTime()
})).toString('base64')
PATCH /structured-data/:handleId
window.safeStructuredData.updateData(this._authToken, handleId, payload)
Save the structured data
The plugin saves the new version of the comment by sending a POST request to the SAFE Network.
POST /structured-data/:handleId
window.safeStructuredData.post(this._authToken, handleId)
Drop the structured data handle
The plugin drops the structured data handle of the comment.
DELETE /structured-data/handle/:handleId
window.safeStructuredData.dropHandle(this._authToken, dataIdHandle)
Drop the data identifier handle
The plugin drops the data identifier handle of the comment.
DELETE /data-id/:handleId
window.safeDataId.dropHandle(this._authToken, dataIdHandle)
Last updated
Was this helpful?