Skip to content

Commit

Permalink
Merge pull request #71 from THeK3nger/master
Browse files Browse the repository at this point in the history
Delete history for deleted files
  • Loading branch information
lukeleppan authored Jan 25, 2023
2 parents 6676fc6 + da44785 commit 76ac1fb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/stats/StatsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@ export default class StatsManager {
);

this.vault.on("rename", (new_name, old_path) => {
const content = this.vaultStats.modifiedFiles[old_path];
delete this.vaultStats.modifiedFiles[old_path];
this.vaultStats.modifiedFiles[new_name.path] = content;
if (this.vaultStats.modifiedFiles.hasOwnProperty(old_path)) {
const content = this.vaultStats.modifiedFiles[old_path];
delete this.vaultStats.modifiedFiles[old_path];
this.vaultStats.modifiedFiles[new_name.path] = content;
}
});

this.vault.on("delete", (deleted_file) => {
if (this.vaultStats.modifiedFiles.hasOwnProperty(deleted_file.path)) {
delete this.vaultStats.modifiedFiles[deleted_file.path];
}
});

this.vault.adapter.exists(STATS_FILE).then(async (exists) => {
Expand Down

0 comments on commit 76ac1fb

Please sign in to comment.