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.


Edit a comment

Edit comment modal

Get the comment from the appendable data

The plugin fetches a data identifier handle for the comment you want to edit.

Get data ID handle at index

GET /appendable-data/:handleId/:index
    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

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()

Update structured data

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.

Save structured data

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.

Drop structured data handle

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.

Drop data ID handle

DELETE /data-id/:handleId
window.safeDataId.dropHandle(this._authToken, dataIdHandle)

results matching ""

    No results matching ""