Merge pull request #114 from ONLYOFFICE/feature/fix-history

Feature/fix history
This commit is contained in:
Sergey Linnik
2021-02-02 13:09:41 +03:00
committed by GitHub
21 changed files with 76 additions and 80 deletions

View File

@ -93,7 +93,7 @@ namespace OnlineEditorsExampleMVC.Helpers
public static int GetFileVersion(string historyPath)
{
if (!Directory.Exists(historyPath)) return 0;
return Directory.EnumerateDirectories(historyPath).Count();
return Directory.EnumerateDirectories(historyPath).Count() + 1;
}
public static int GetFileVersion(string fileName, string userAddress)
@ -141,7 +141,7 @@ namespace OnlineEditorsExampleMVC.Helpers
var histDir = HistoryDir(StoragePath(fileName, null));
Directory.CreateDirectory(histDir);
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), new JavaScriptSerializer().Serialize(new Dictionary<string, object> {
{ "created", DateTime.Now.ToString() },
{ "created", DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss") },
{ "id", string.IsNullOrEmpty(uid) ? "uid-1" : uid },
{ "name", string.IsNullOrEmpty(uname) ? "John Smith" : uname }
}));