[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 version.diff = false
} }
else if( version.content === '' )
{
version.diff = [ { count: 1, added: true, removed: undefined, value: 'a'} ]
if( last_version.content === '' )
{
return false
}
}
else else
{ {
version.diff = diff.diffLines( version.diff = diff.diffLines(
@@ -54,9 +63,11 @@ class File
) )
// No changed // No changed
if( version.diff.length === 1 ) if( version.diff.length === 1 && last_version.content !== '' )
{
return false return false
} }
}
// Emit // Emit
this.socket.emit( 'create_version', { file: this.path.full, version: version } ) this.socket.emit( 'create_version', { file: this.path.full, version: version } )
+1 -1
View File
@@ -54,7 +54,7 @@ class Files
// Retrieve file // Retrieve file
let file = this.get( normalized_path, true ) let file = this.get( normalized_path, true )
if( _content ) if( typeof _content !== 'undefined' )
{ {
// Create version // Create version
file.create_version( _content ) file.create_version( _content )
+3
View File
@@ -0,0 +1,3 @@
dsfsdf
dfiuhsdifuhdsfiuh
dsfsdf