Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-56136

Cannot Access My Drafts After Uninstalling Confluence Questions

XMLWordPrintable

      Summary

      Cannot access User Profile > Drafts after uninstalling the Confluence Questions plugin due to existing drafts related to this plugin that cannot be converted correctly once the plugin is uninstalled.

      Steps to Reproduce

      1. Install Confluence Questions
      2. Create a question
      3. Select a space from "Ask in a space"
      4. Enter a question title, description, and select a topic
      5. Before clicking save, a draft will appear in User Profile > Drafts
      6. Now uninstall the plugin
      7. Try to access User Profile > Drafts again

      Expected Results

      • The current drafts the user has will show in the list.

      Actual Results

      The page shows an error like the one below:

      org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getBodyAsString' in class com.atlassian.confluence.content.CustomContentEntityObject threw exception java.lang.UnsupportedOperationException: The body of this ContentEntityObject ('') was 'BodyType:XHTML' but was expected to be 'BodyType:RAW' at /users/viewmydrafts.vm[line 47, column 29]
      

      Workaround

      A temporary workaround is to delete the draft created for the Confluence Questions plugin from the database.

      1. Make sure to take a backup copy of the database before running any queries.
      2. Run the queries below to delete the drafts related to the Confluence Questions plugin:
        DELETE
        FROM contentproperties
        WHERE contentid IN
            (SELECT contentid
             FROM CONTENT
             WHERE CONTENT_STATUS='draft'
               AND pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:answer-draft');
        
        
        DELETE
        FROM bodycontent
        WHERE contentid IN
            (SELECT contentid
             FROM CONTENT
             WHERE CONTENT_STATUS='draft'
               AND pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:answer-draft');
        
        
        DELETE
        FROM notifications
        WHERE contentid IN
            (SELECT contentid
             FROM CONTENT
             WHERE CONTENT_STATUS='draft'
               AND pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:answer-draft');
        
        
        DELETE
        FROM imagedetails
        WHERE attachmentid IN
            (SELECT contentid
             FROM content
             WHERE pageid IN
                 (SELECT contentid
                  FROM CONTENT
                  WHERE CONTENT_STATUS='draft'
                    AND pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:answer-draft'));
        
        
        DELETE
        FROM contentproperties
        WHERE contentid IN
            (SELECT contentid
             FROM content
             WHERE pageid IN
                 (SELECT contentid
                  FROM CONTENT
                  WHERE CONTENT_STATUS='draft'
                    AND pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:answer-draft'));
        
        
        DELETE
        FROM content
        WHERE pageid IN
            (SELECT xid
             FROM
               (SELECT c.contentid AS xid
                FROM content c
                WHERE CONTENT_STATUS='draft'
                  AND pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:answer-draft') AS x);
        
      3. Restart Confluence.

      In case you face any constraint problems while running the queries above, please raise a support ticket providing the latest logs and the queries that worked and failed so we can help you.

              Unassigned Unassigned
              emallmann Eduardo Mallmann (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: