1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

fix delete file tag

This commit is contained in:
Michael An
2019-04-21 10:21:48 +08:00
parent 5dda067933
commit 6035d53b4c
3 changed files with 12 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ const propTypes = {
toggleCancel: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
updateUsedRepoTags: PropTypes.func.isRequired,
onFileTagChanged: PropTypes.func,
};
class ListTaggedFilesDialog extends React.Component {
@@ -23,12 +24,20 @@ class ListTaggedFilesDialog extends React.Component {
};
}
onFileTagChanged = (TaggedFile) => {
const path = TaggedFile.parent_path;
const dirent = {name: TaggedFile.filename};
let direntPath = path === '/' ? path + TaggedFile.filename : path + '/' + TaggedFile.filename;
this.props.onFileTagChanged(dirent, direntPath);
}
onDeleteTaggedFile = (taggedFile) => {
let repoID = this.props.repoID;
let fileTagID = taggedFile.file_tag_id;
seafileAPI.deleteFileTag(repoID, fileTagID).then(res => {
this.getTaggedFiles();
this.props.updateUsedRepoTags();
if (this.props.onFileTagChanged) this.onFileTagChanged(taggedFile);
});
}

View File

@@ -64,6 +64,7 @@ class DirListView extends React.Component {
draftCounts={this.props.draftCounts}
usedRepoTags={this.props.usedRepoTags}
updateUsedRepoTags={this.props.updateUsedRepoTags}
onFileTagChanged={this.props.onFileTagChanged}
/>
)}
<DirentListView

View File

@@ -16,6 +16,7 @@ const propTypes = {
readmeMarkdown: PropTypes.object,
draftCounts: PropTypes.number,
updateUsedRepoTags: PropTypes.func.isRequired,
onFileTagChanged: PropTypes.func.isRequired,
};
class RepoInfoBar extends React.Component {
@@ -107,6 +108,7 @@ class RepoInfoBar extends React.Component {
onClose={this.onCloseDialog}
toggleCancel={this.onListTaggedFiles}
updateUsedRepoTags={this.props.updateUsedRepoTags}
onFileTagChanged={this.props.onFileTagChanged}
/>
</ModalPortal>
)}