self.backend.messages.send_template("wiki/messages/page-changed",
account=watcher, page=self, priority=-10)
- def restore(self, author, address):
+ def restore(self, author, address, comment=None):
changes = "Restore to revision from %s" % self.timestamp.isoformat()
+ # Append comment
+ if comment:
+ changes = "%s: %s" % (changes, comment)
+
return self.backend.wiki.create_page(self.page,
author, self.markdown, changes=changes, address=address)
<input type="hidden" name="path" value="{{ page.page }}">
<input type="hidden" name="revision" value="{{ page.timestamp.isoformat() }}">
+ <div class="form-group">
+ <input class="form-control" type="text" name="comment"
+ placeholder="{{ _("Comment") }}">
+ </div>
+
<button type="submit" class="btn btn-warning btn-block">
{{ _("Restore") }}
</button>
# Check if we are asked to render a certain revision
revision = self.get_argument("revision", None)
+ comment = self.get_argument("comment", None)
# Fetch the wiki page
page = self.backend.wiki.get_page(path, revision=revision)
with self.db.transaction():
page = page.restore(
- author=self.current_user, address=self.get_remote_ip(),
+ author=self.current_user,
+ address=self.get_remote_ip(),
+ comment=comment,
)
# Redirect back to page