{"action":"closed","issue":{"url":"https://api.github.com/repos/divio/django-cms/issues/3811","labels_url":"https://api.github.com/repos/divio/django-cms/issues/3811/labels{/name}","comments_url":"https://api.github.com/repos/divio/django-cms/issues/3811/comments","events_url":"https://api.github.com/repos/divio/django-cms/issues/3811/events","html_url":"https://github.com/divio/django-cms/issues/3811","id":56182631,"number":3811,"title":"Broken undo causes corruption in page. Kills page view and page publish operations.","user":{"login":"doctormo","id":589384,"avatar_url":"https://avatars.githubusercontent.com/u/589384?v=3","gravatar_id":"","url":"https://api.github.com/users/doctormo","html_url":"https://github.com/doctormo","followers_url":"https://api.github.com/users/doctormo/followers","following_url":"https://api.github.com/users/doctormo/following{/other_user}","gists_url":"https://api.github.com/users/doctormo/gists{/gist_id}","starred_url":"https://api.github.com/users/doctormo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doctormo/subscriptions","organizations_url":"https://api.github.com/users/doctormo/orgs","repos_url":"https://api.github.com/users/doctormo/repos","events_url":"https://api.github.com/users/doctormo/events{/privacy}","received_events_url":"https://api.github.com/users/doctormo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/divio/django-cms/labels/has%20patch","name":"has patch","color":"fad8c7"},{"url":"https://api.github.com/repos/divio/django-cms/labels/kind:%20bug","name":"kind: bug","color":"c7def8"},{"url":"https://api.github.com/repos/divio/django-cms/labels/needs%20more%20info","name":"needs more info","color":"e11d21"},{"url":"https://api.github.com/repos/divio/django-cms/labels/status:%20accepted","name":"status: accepted","color":"0052cc"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/divio/django-cms/milestones/46","html_url":"https://github.com/divio/django-cms/milestones/3.2.1","labels_url":"https://api.github.com/repos/divio/django-cms/milestones/46/labels","id":1478126,"number":46,"title":"3.2.1","description":"","creator":{"login":"mkoistinen","id":615759,"avatar_url":"https://avatars.githubusercontent.com/u/615759?v=3","gravatar_id":"","url":"https://api.github.com/users/mkoistinen","html_url":"https://github.com/mkoistinen","followers_url":"https://api.github.com/users/mkoistinen/followers","following_url":"https://api.github.com/users/mkoistinen/following{/other_user}","gists_url":"https://api.github.com/users/mkoistinen/gists{/gist_id}","starred_url":"https://api.github.com/users/mkoistinen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkoistinen/subscriptions","organizations_url":"https://api.github.com/users/mkoistinen/orgs","repos_url":"https://api.github.com/users/mkoistinen/repos","events_url":"https://api.github.com/users/mkoistinen/events{/privacy}","received_events_url":"https://api.github.com/users/mkoistinen/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":43,"state":"closed","created_at":"2015-12-30T13:42:47Z","updated_at":"2016-02-01T17:54:32Z","due_on":null,"closed_at":"2016-02-01T17:54:05Z"},"comments":15,"created_at":"2015-02-01T23:08:49Z","updated_at":"2016-02-01T17:54:32Z","closed_at":"2016-02-01T17:54:32Z","body":"An undo error 'Could not revert revision, due to database integrity errors.' caused Page field 'publisher_public' to become unhinged. It's a double link between draft and live version, but if one of those links is broken (not both!) then the page is in an unstable state.\r\n\r\nWe had publisher_public==None in the draft(pk=2) and publisher_public==2 set in the live version(pk=942). This meant viewing the page threw error A and attempting to publish the page threw error B.\r\n\r\nA:\r\n```\r\nFile \"/var/www/www.inkscape.org/pythonenv/lib/python2.7/site-packages/cms/models/pagemodel.py\", line 954, in has_view_permission\r\n    return self.publisher_draft.has_view_permission(request, user)\r\nDoesNotExist: Page has no publisher_draft.\r\n```\r\n\r\nB:\r\n```\r\nFile \"/var/www/www.inkscape.org/pythonenv/lib/python2.7/site-packages/cms/models/pagemodel.py\", line 574, in publish\r\n    public_page.save()\r\nIntegrityError: (1062, \"Duplicate entry '2' for key 'publisher_public_id'\")\r\n```\r\n\r\nThe error had to be fixed manually from a django shell:\r\n```\r\nPage.objects.filter(pk=2).update(publisher_public=Page.objects.filter(publisher_public=2)[0])\r\n```\r\nBut idealy the software would be able to detect these issues and repair itself, especially when hitting the publish button."}}