outline / outline

The fastest knowledge base for growing teams. Beautiful, realtime collaborative, feature packed, and markdown compatible.
https://www.getoutline.com
Other
28.42k stars 2.27k forks source link

Restore Archive ignores sub pages #6923

Open FiretronP75 opened 6 months ago

FiretronP75 commented 6 months ago

I accidentally archived a page that has thousands of sub pages. When I restored it, none of the sub pages restored with it. There are too many to do it one by one.

To Reproduce Steps to reproduce the behavior:

  1. Archive a page with sub pages.
  2. Check in archives and see that all sub pages are archived with it.
  3. Restore the page with sub pages.
  4. Check in page and see that the sub pages were not restored with it.

Expected behavior Anything that archives together, should restore together.

Outline (please complete the following information):

Desktop (please complete the following information):

linear[bot] commented 6 months ago

OLN-382 Restore Archive ignores sub pages

FiretronP75 commented 6 months ago

And to quickly fix my immediate issue, is there some command I can run to restore all archived?

Limezy commented 6 months ago

I guess you may look at the api ?

https://www.getoutline.com/developers#tag/Documents/paths/~1documents.restore/post

FiretronP75 commented 6 months ago

I guess you may look at the api ?

https://www.getoutline.com/developers#tag/Documents/paths/~1documents.restore/post

The API also makes you restore them one at a time. A loop could be coded, except there is no API for List all archive documents. Search all documents has a status filter for archived. That would work if all the parameters are optional. And it looks like they are because on other API endpoints it says Required under some fields.

OK, so I need to create an API token, then write a script that hits /documents.search with { "statusFilter": "archived" } then loop over the result and call documents.restore on each one with { "id": "itsID" } and that should restore everything that is archived.

FiretronP75 commented 6 months ago

I see in the code https://github.com/outline/outline/blob/main/server/routes/api/documents/documents.ts that there is of course endpoints for list archived and list deleted because the GUI uses those. Are they accidentally missing from the documentation? Or are they only accessible from the app?

I see that the ones listed in the docs have auth() while the others have auth({ role: UserRole.Member }) so I'm guessing that makes them only accessible by the app.

FiretronP75 commented 5 months ago

on the documents.search I'm getting a validation error 'query: Required' even tho the docs say it is optional. does query take wildcards like * or % ?

tommoor commented 5 months ago

This is very unfortunate, I would honestly just restore the database if you have a backup. It would be easier allaround but I'm guessing that's not an option here. To answer your questions:

FiretronP75 commented 5 months ago

* does not work for search. I will try documents.archived

FiretronP75 commented 5 months ago

Are you sure it is not a bug, that subpages do not restore along with parents? I think it works like that for Trash. And of course in Notion. I guess you might call it a feature, but it is inconsistent to have them archive as a group but not restore as a group.

tommoor commented 5 months ago

It's borderline for sure, it was designed like this so not a bug – but probably a bad decision and the behavior should be changed.

FiretronP75 commented 5 months ago

I have them all restored now using a script hitting the API.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days

FiretronP75 commented 1 month ago

This is still a good enhancement. Let's keep it open.