chore: Refactor backlinks and revisions (#1611)
* Update backlinks service to not rely on revisions * fix: Add missing index for finding backlinks * Debounce revision creation (#1616) * refactor debounce logic to service * Debounce slack notification * Revisions created by service * fix: Revision sidebar latest * test: Add tests for notifications
This commit is contained in:
@@ -49,6 +49,21 @@ Revision.findLatest = function (documentId) {
|
||||
});
|
||||
};
|
||||
|
||||
Revision.createFromDocument = function (document) {
|
||||
return Revision.create({
|
||||
title: document.title,
|
||||
text: document.text,
|
||||
userId: document.lastModifiedById,
|
||||
editorVersion: document.editorVersion,
|
||||
version: document.version,
|
||||
documentId: document.id,
|
||||
|
||||
// revision time is set to the last time document was touched as this
|
||||
// handler can be debounced in the case of an update
|
||||
createdAt: document.updatedAt,
|
||||
});
|
||||
};
|
||||
|
||||
Revision.prototype.migrateVersion = function () {
|
||||
let migrated = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user