Fixed Issue #659 (#964)

* Fixed Issue #659

* Undo changes in package.json and package-lock.json

* Resolved error
This commit is contained in:
Ankur Ingale 2019-03-22 02:38:46 +05:30 committed by Cassie Tarakajian
parent 2c876cda45
commit 80765e03c7
3 changed files with 30 additions and 7 deletions

View file

@ -156,7 +156,6 @@ export class FileNode extends React.Component {
ref={(element) => { this[`fileOptions-${this.props.id}`] = element; }} ref={(element) => { this[`fileOptions-${this.props.id}`] = element; }}
tabIndex="0" tabIndex="0"
onClick={this.toggleFileOptions} onClick={this.toggleFileOptions}
onBlur={() => setTimeout(this.hideFileOptions, 200)}
> >
<InlineSVG src={downArrowUrl} /> <InlineSVG src={downArrowUrl} />
</button> </button>
@ -168,7 +167,10 @@ export class FileNode extends React.Component {
<li> <li>
<button <button
aria-label="add file" aria-label="add file"
onClick={this.props.newFile} onClick={() => {
this.props.newFile();
setTimeout(() => this.hideFileOptions(), 0);
}}
className="sidebar__file-item-option" className="sidebar__file-item-option"
> >
Add File Add File
@ -183,7 +185,10 @@ export class FileNode extends React.Component {
<li> <li>
<button <button
aria-label="add folder" aria-label="add folder"
onClick={this.props.newFolder} onClick={() => {
this.props.newFolder();
setTimeout(() => this.hideFileOptions(), 0);
}}
className="sidebar__file-item-option" className="sidebar__file-item-option"
> >
Add Folder Add Folder
@ -198,6 +203,7 @@ export class FileNode extends React.Component {
this.originalFileName = this.props.name; this.originalFileName = this.props.name;
this.showEditFileName(); this.showEditFileName();
setTimeout(() => this.fileNameInput.focus(), 0); setTimeout(() => this.fileNameInput.focus(), 0);
setTimeout(() => this.hideFileOptions(), 0);
}} }}
className="sidebar__file-item-option" className="sidebar__file-item-option"
> >
@ -213,6 +219,9 @@ export class FileNode extends React.Component {
setTimeout(() => this.props.deleteFile(this.props.id, this.props.parentId), 100); setTimeout(() => this.props.deleteFile(this.props.id, this.props.parentId), 100);
} }
}} }}
onBlur={() => {
setTimeout(this.hideFileOptions, 200);
}}
className="sidebar__file-item-option" className="sidebar__file-item-option"
> >
Delete Delete

View file

@ -65,18 +65,30 @@ class Sidebar extends React.Component {
tabIndex="0" tabIndex="0"
ref={(element) => { this.sidebarOptions = element; }} ref={(element) => { this.sidebarOptions = element; }}
onClick={this.toggleProjectOptions} onClick={this.toggleProjectOptions}
onBlur={() => setTimeout(this.props.closeProjectOptions, 200)}
> >
<InlineSVG src={downArrowUrl} /> <InlineSVG src={downArrowUrl} />
</button> </button>
<ul className="sidebar__project-options"> <ul className="sidebar__project-options">
<li> <li>
<button aria-label="add folder" onClick={this.props.newFolder} > <button
aria-label="add folder"
onClick={() => {
this.props.newFolder();
setTimeout(this.props.closeProjectOptions, 0);
}}
>
Add folder Add folder
</button> </button>
</li> </li>
<li> <li>
<button aria-label="add file" onClick={this.props.newFile} > <button
aria-label="add file"
onClick={() => {
this.props.newFile();
setTimeout(this.props.closeProjectOptions, 0);
}}
onBlur={() => { setTimeout(this.props.closeProjectOptions, 200); }}
>
Add file Add file
</button> </button>
</li> </li>

View file

@ -110,7 +110,9 @@ export function getProject(req, res) {
function deleteFilesFromS3(files) { function deleteFilesFromS3(files) {
deleteObjectsFromS3(files.filter((file) => { deleteObjectsFromS3(files.filter((file) => {
if (file.url) { if (file.url) {
if (!process.env.S3_DATE || (process.env.S3_DATE && isBefore(new Date(process.env.S3_DATE), new Date(file.createdAt)))) { if (!process.env.S3_DATE || (
process.env.S3_DATE &&
isBefore(new Date(process.env.S3_DATE), new Date(file.createdAt)))) {
return true; return true;
} }
} }