Skip to content

Commit

Permalink
Merge pull request #477 from ONLYOFFICE/feature/editor-history
Browse files Browse the repository at this point in the history
Feature/editor history
  • Loading branch information
AlexeySafronov authored Dec 10, 2021
2 parents 805718a + 6e6a12f commit 0855ead
Show file tree
Hide file tree
Showing 9 changed files with 504 additions and 229 deletions.
23 changes: 23 additions & 0 deletions packages/asc-web-common/api/files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,3 +809,26 @@ export function fileCopyAs(fileId, destTitle, destFolderId, enableExternalExt) {
},
});
}

export function getEditHistory(fileId, doc) {
return request({
method: "get",
url: `files/file/${fileId}/edit/history?doc=${doc}`,
});
}

export function getEditDiff(fileId, version, doc) {
return request({
method: "get",
url: `files/file/${fileId}/edit/diff?version=${version}&doc=${doc}`,
});
}

export function restoreDocumentsVersion(fileId, version, doc) {
const options = {
method: "get",
url: `files/file/${fileId}/restoreversion?version=${version}&doc=${doc}`,
};

return request(options);
}
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static void Register(DIHelper services)

services.TryAdd<ILinkDao, LinkDao>();

// AddSharpBoxDaoSelectorService
services.TryAdd<EditHistory>();
}
}
}
4 changes: 1 addition & 3 deletions products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,14 +1202,12 @@ public List<EditHistory> GetEditHistory(DocumentServiceHelper documentServiceHel
.Select(r =>
{
var item = ServiceProvider.GetService<EditHistory>();
var editHistoryAuthor = ServiceProvider.GetService<EditHistoryAuthor>();

editHistoryAuthor.Id = r.ModifiedBy;
item.ID = r.Id;
item.Version = r.Version;
item.VersionGroup = r.VersionGroup;
item.ModifiedOn = TenantUtil.DateTimeFromUtc(r.ModifiedOn);
item.ModifiedBy = editHistoryAuthor;
item.ModifiedBy = r.ModifiedBy;
item.ChangesString = r.Changes;
item.Key = documentServiceHelper.GetDocKey(item.ID, item.Version, TenantUtil.DateTimeFromUtc(r.CreateOn));

Expand Down
Loading

0 comments on commit 0855ead

Please sign in to comment.