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:
@@ -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}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
Reference in New Issue
Block a user