1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

copy_file_from_history (#5486)

* copy_file_from_history

* fix SeadocCopyHistoryFile
This commit is contained in:
欢乐马
2023-06-15 16:27:24 +08:00
committed by GitHub
parent 15dfbd6c17
commit fab9c039af
4 changed files with 91 additions and 2 deletions

View File

@@ -115,6 +115,19 @@ class SidePanel extends Component {
this.props.onSelectHistoryVersion(historyVersion, historyVersions[historyVersionIndex + 1]);
}
copyHistoryFile = (historyVersion) => {
const { path, revFileId, ctime } = historyVersion;
seafileAPI.sdocCopyHistoryFile(historyRepoID, path, revFileId, ctime).then(res => {
let message = gettext('Successfully copied %(name)s.');
let filename = res.data.file_name;
message = message.replace('%(name)s', filename);
toaster.success(message);
}).catch(error => {
const errorMessage = Utils.getErrorMsg(error, true);
toaster.danger(gettext(errorMessage));
});
}
renderHistoryVersions = () => {
const { isLoading, historyVersions, errorMessage } = this.state;
if (historyVersions.length === 0) {
@@ -150,6 +163,7 @@ class SidePanel extends Component {
historyVersion={historyVersion}
onSelectHistoryVersion={this.onSelectHistoryVersion}
onRestore={this.restoreVersion}
onCopy={this.copyHistoryFile}
/>
);
})}