[fix] Empty file saving not received

This commit is contained in:
brunosimon
2016-10-24 21:08:29 +02:00
parent b720c3337f
commit 71b5445bf6
3 changed files with 16 additions and 2 deletions
+12 -1
View File
@@ -43,6 +43,15 @@ class File
{
version.diff = false
}
else if( version.content === '' )
{
version.diff = [ { count: 1, added: true, removed: undefined, value: 'a'} ]
if( last_version.content === '' )
{
return false
}
}
else
{
version.diff = diff.diffLines(
@@ -54,9 +63,11 @@ class File
)
// No changed
if( version.diff.length === 1 )
if( version.diff.length === 1 && last_version.content !== '' )
{
return false
}
}
// Emit
this.socket.emit( 'create_version', { file: this.path.full, version: version } )
+1 -1
View File
@@ -54,7 +54,7 @@ class Files
// Retrieve file
let file = this.get( normalized_path, true )
if( _content )
if( typeof _content !== 'undefined' )
{
// Create version
file.create_version( _content )
+3
View File
@@ -0,0 +1,3 @@
dsfsdf
dfiuhsdifuhdsfiuh
dsfsdf