Commit a8dbb5f1 by Bridger Maxwell

Fixed confusing if statement that had the side effect of restoring every deleted…

Fixed confusing if statement that had the side effect of restoring every deleted article a moderator views.
parent c4325748
...@@ -333,20 +333,22 @@ class Deleted(Delete): ...@@ -333,20 +333,22 @@ class Deleted(Delete):
return redirect('wiki:get', article_id=article.id) return redirect('wiki:get', article_id=article.id)
# Restore # Restore
if (request.GET.get('restore', False) and if request.GET.get('restore', False):
(not article.current_revision.locked and article.can_delete(request.user)) or can_restore = not article.current_revision.locked and article.can_delete(request.user)
article.can_moderate(request.user)): can_restore = can_restore or article.can_moderate(request.user)
revision = models.ArticleRevision()
revision.inherit_predecessor(self.article) if can_restore:
revision.set_from_request(request) revision = models.ArticleRevision()
revision.deleted = False revision.inherit_predecessor(self.article)
revision.automatic_log = _('Restoring article') revision.set_from_request(request)
self.article.add_revision(revision) revision.deleted = False
messages.success(request, _(u'The article "%s" and its children are now restored.') % revision.title) revision.automatic_log = _('Restoring article')
if self.urlpath: self.article.add_revision(revision)
return redirect('wiki:get', path=self.urlpath.path) messages.success(request, _(u'The article "%s" and its children are now restored.') % revision.title)
else: if self.urlpath:
return redirect('wiki:get', article_id=article.id) return redirect('wiki:get', path=self.urlpath.path)
else:
return redirect('wiki:get', article_id=article.id)
return super(Deleted, self).dispatch1(request, article, *args, **kwargs) return super(Deleted, self).dispatch1(request, article, *args, **kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment