mirror of
https://github.com/outline/outline.git
synced 2026-11-23 06:11:04 +03:00
avoid overriding restore
This commit is contained in:
1 parent
9306a0390e
commit
b680a3e152
2 files changed
+5
-3
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user