avoid overriding restore

This commit is contained in:
Tom Moor committed 2021-10-27 22:52:30 -07:00
1 parent 9306a0390e
commit b680a3e152
2 files changed
+5 -3

No files matched your search

+4 -2
View File
@@ -674,7 +674,7 @@ Document.prototype.unarchive = async function (userId: string) {
return this;
};
Document.prototype.restore = async function (
Document.prototype.restoreFromRevision = async function (
revision: Revision,
userId: string
) {
@@ -685,7 +685,9 @@ Document.prototype.restore = async function (
this.text = revision.text;
this.title = revision.title;
this.lastModifiedById = userId;
return await this.save();
await this.save();
return this;
};
// Delete a document, archived or otherwise.
+1 -1
View File
@@ -713,7 +713,7 @@ router.post("documents.restore", auth(), async (ctx) => {
const revision = await Revision.findByPk(revisionId);
authorize(document, "restore", revision);
await document.restore(revision, user.id);
await document.restoreFromRevision(revision, user.id);
await Event.create({
name: "documents.restore",