Someone's unpublished draft created a ghost child page - how can I find that page and remove it?
Asked by Arezou Seifpour:

I have a page that has a child dropdown but when I click on the dropdown, no page exists. I can recreate this situation by opening up an unpublished draft which creates a child dropdown carrot that in another browser I can see has nothing underneath it. When I delete the unpublished draft, that dropdown goes away. So how can I figure out who has an unpublished draft in my docs?


Answers:
author: Andrii Maliuta
body: Hello [@Arezou Seifpour](/t5/user/viewprofilepage/user-id/5026540) ,

You can try to use REST API to get the DRAFTS:

<https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-get>

ALL - <https://MY_CONFLUENCE.atlassian.net/wiki/rest/api/content?status=draft>

SPACE - [https://MY_CONFLUENCE.atlassian.net/wiki/rest/api/content?status=draft\&space=MY_SPACE](https://MY_CONFLUENCE.atlassian.net/wiki/rest/api/content?status=draft&space=MY_SPACE)

It will show the drafts and you can further extract the history/author/etc. data

You can use API parameters to configure the results you need.

comments: author: Mia Cheeseman
body: Has anyone translated that suggestion into English? I have the same problem. My categories have arrows as if there's something under them. They should just be bulleted child pages.


author: Christopher Hopper
body: You can see your unpublished drafts using the menu bar at the top of a Confluence page.

From the top menu bar

1. Click on Recent to show recent pages you visited
2. Under Recent, click on Drafts to show your recent draft pages
3. At the bottom of that recent drafts list, click on View all drafts to show all the unpublished draft pages you have created

Unfortunately this does not show me the ghost draft page causing my Confluence menu to show an arrow instead of a disc. I have the same problem as the original post.

My solution was to recreate the page. I created a new page. I copied all the information from the old page. I then published the new page and deleted the old page that had the ghost child attached to it.

-Christopher


author: Matthew Scott
body: So I've investigated this issue and fully understand what's going on here. It's 100% replicable and incredible that the development team haven't picked this up yet, because it's a major problem.

This problem occurs when somebody hits the "Create Child Page" plus button in the side panel, and then quickly clicks "Close Draft" without making any changes. **Specifically, it occurs when you don't set a page title before closing the draft.**

It creates a phantom page which is still recognised as a child by the parent, but is not returned in the list of children because it doesn't have a name. This causes 2 issues. The first is that the little icon next to the page title is a drop down arrow when it shouldn't be. The second is that the draft **does not** show up in "Recent Drafts" where you'd normally be able to retrieve it.

I wrote an integration with the API just to test this to make sure, and the API doesn't return *any* data relating to these phantom pages. Basically, if a page doesn't have a name, it's there as a draft but it's not visible.

This is some classic Australian programming by the looks of it. If it doesn't have a name, just filter it out ?

In order to determine what was going on, I tested a few potential fixes. First I created pages on other layers and dragged them into the page with the phantom child. Then dragged it out. I thought that might reset the icon at first. Then I tried creating new children in that same page and then deleting them after, still no good. And this essentially confirmed to me that the draft is still there, it's just not being listed (either on the web UI *or* in the API).

There's **only one solution** guys. You have to delete the page with the phantom child and recreate it. It's incredibly inconvenient when you've done a bunch of work linking it up with the rest of your wiki.

I'd submit a bug report but I've read a few on other issues already that were closed on reasoning along the lines of, "we're going to use our resources to make new features instead of fixing this bug, maybe we'll come back to it in a few years but we closed it so probably not." So yeah, I'm not 100% confident with my choice to use Confluence for our project right now. I hope this is the last bug I run into.


author: Ross Brooker
body: Same problem, and agree exactly with the reply by [@Matthew Scott](/t5/user/viewprofilepage/user-id/5425849)   

I managed to use the API from Andrii's reply to list out all the active drafts, and judging by the ID's within the results there's a good chance my two problem pages are in there.

But there's nothing in those results that lets me actually access the drafts to do anything with them - if I plug the page ID into the standard view URL I only ever get the "We couldn't find what you're looking for" page.

Is there a URL that will instruct an API, taking a page ID as the only required parameter, that will just go ahead and delete the draft page?  

Edit:  
I've researched this a bit more - and that indicates trying to set the page to 'trashed' might also do the trick, but I'm wary of experimenting with URLs to call APIs in case I accidentally trash or delete swathes of my company's pages!


author: Christopher Hopper
body: Matthew Scott lost me entirely when he said:
> This is some classic Australian programming by the looks of it. If it doesn't have a name, just filter it out ?

![australian-programming-classic.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/309370i64E67C22D7F7505F/image-dimensions/451x631?v=v2 "australian-programming-classic.jpeg")


author: Matthew Scott
body: [@Christopher Hopper](/t5/user/viewprofilepage/user-id/3995240) oh sorry, I thought since I spent all that time diagnosing the issue that I might be entitled to a joke or two. Especially when this is an issue that very likely will never be addressed.


author: Matthew Scott
body: [@Ross Brooker](/t5/user/viewprofilepage/user-id/5440446) your analysis is good. The problem here is that the page is technically in draft status, not trashed. When the draft doesn't have a title (as it won't when you just created the page), it is automatically filtered out of any results that it should show up in. They probably have something along the lines of

```
if (page.name.length > 0) { ...show in results... } else { ...don't show... }
```

Obviously there'd be more checks than just that, but that'd be the condition that's causing the issue.

I wrote my own program for interfacing with the API and judging by the documentation, I'm really not sure anything would let you change it to 'trashed', because any reference to the page will just be filtered from results for the reason above. Like when you said going directly to the page gave you, "We couldn't find what you're looking for".

The developers need to remove the filter that removes pages without names from the results on all endpoints. Once they've done that, we can treat them like normal pages and remove them (even from the web interface).


author: Cristiano Rastelli
body: The solution suggested by [@Andrii Maliuta](/t5/user/viewprofilepage/user-id/4828170) above worked for me:

* visit [https://MY_CONFLUENCE.atlassian.net/wiki/rest/api/content?status=draft](https://my_confluence.atlassian.net/wiki/rest/api/content?status=draft) (logged in, and replace "MY_CONFLUENCE" with your instance name)
* you will see a list of draft in JSON format each one with its own ID
* for each ID
  * visit <https://MY_CONFLUENCE.atlassian.net/wiki/pages/viewinfo.action?pageId=DRAFT_ID>
  * click on the "Visit page" button on the top right of the page
  * now you can see the draft and see if it's a valid draft
  * if it's not a valid draft that you want to preserve, you can delete it using the three dots menu


Tags: cloud

confluence-cloud