Skip to content

Commit

Permalink
[Fix] Renaming directories (#867)
Browse files Browse the repository at this point in the history
* Edit -> Rename

* Only rename files if the title changed
  • Loading branch information
samdenty authored and CompuIves committed May 29, 2018
1 parent d24cd32 commit 177c621
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function EditIcons({
{(hovering || (window.__isTouch && active) || forceShow) && (
<Container>
{onEdit && (
<Tooltip title="Edit">
<Tooltip title="Rename">
<Icon onClick={handleClick(onEdit)}>
<EditIcon />
</Icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ class Entry extends React.PureComponent {
this.setState({ error: isInvalidTitle });
};

handleRename = (title, force) => {
const { shortid } = this.props;
const canRename = !this.handleValidateTitle(title);
handleRename = (newTitle, force) => {
const { shortid, title } = this.props
if (newTitle === title) return

const canRename = !this.handleValidateTitle(newTitle);
if (canRename && this.props.rename) {
this.props.rename(shortid, title);
this.props.rename(shortid, newTitle);
this.resetState();
} else if (force) this.resetState();
};
Expand Down

0 comments on commit 177c621

Please sign in to comment.