Remediate the 2026-09-03 feature-test findings

This commit is contained in:
2026-09-03 17:14:53 -04:00
parent ddf41c3e65
commit ff9ae693a6
112 changed files with 5182 additions and 857 deletions

View File

@@ -503,8 +503,19 @@ def restore_revision(guideid, revisionid):
'You do not have permission to edit this guide',
http_code=403)
before = guide.revision
authoring.restore(guide, revision, userid=_userid())
db.session.commit()
# save() dedups on the content hash, so restoring the version that is
# already current writes nothing. Saying "Restored version N as a new draft
# version" in that case describes a revision that does not exist - and the
# revision list, unchanged, quietly disagrees with the message.
if guide.revision == before:
return success_response(
guide.to_dict(includeblocks=True),
message='Version {} is already the current content, so nothing '
'changed'.format(revision.revision))
return success_response(guide.to_dict(includeblocks=True),
message='Restored version {} as a new draft version'
.format(revision.revision))