Skip to content

Instantly share code, notes, and snippets.

@DV8FromTheWorld
Last active October 26, 2023 16:19
Show Gist options
  • Save DV8FromTheWorld/b8715523cbb6cdbc935438f0a19300fc to your computer and use it in GitHub Desktop.
Save DV8FromTheWorld/b8715523cbb6cdbc935438f0a19300fc to your computer and use it in GitHub Desktop.
copy(temp1.error.data.requestBody.transactions[0].operations
.filter(operation => operation.command === 'set' && Array.isArray(operation.args) && operation.args.length !== 0)
.map(operation => operation.args.flatMap(arg => Array.isArray(arg) ? arg[0] : arg).join(''))
.join('\n'))
@DV8FromTheWorld
Copy link
Author

DV8FromTheWorld commented Oct 26, 2023

This script is for recovering comments posted on notion that, upon submitting, notion instantly deletes.
This is often because some portion of posting it is failed by the server, likely due to notion thinking you're modifying a document that you don't have permissions to modify when commenting. This most often happens on pages where you have permission to comment but not edit.

You must do so before refreshing the page
If you have already refreshed, it is too late. I'm sorry.

How to use

1. Open the console

2. There will be errors. Scroll up until you find a ClientTransactionError

image

3. Expand the ▶ Object

image

4. Expand ▶ error until you can see miscErrorString

This string is a JSON object containing the entire details of the request and failure. It will contain all the data we need.
image

5. Double click the miscErrorString's content so that it is highlighted.

Copy the content.
image

6. Paste the content into the console.

This content has a leading " and a trailing " that you will need to remove

before after
image image

7. Make into a variable

After that, put const temp1 = in front of the object and press [enter] to save the variable
image

8. Now you can run the code snippet above

image

Something to note is that the beginning of the recovered text will contain the bit of the notion doc that you had highlighted that you were commenting on. Be sure to remove that part!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment