Explorar o código

Pass option to encode range

To ensure backwards compat with clients not refreshing, pass a flag to enable
encoding.  This way, old client won't receive encoded ranges, but also won't
have decoding logic. The flag can then be removed once all clients are up to
date
Alasdair Smith %!s(int64=9) %!d(string=hai) anos
pai
achega
e2bb6dcecb
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      services/web/public/coffee/ide/editor/Document.coffee

+ 2 - 2
services/web/public/coffee/ide/editor/Document.coffee

@@ -252,7 +252,7 @@ define [
 
 		_joinDoc: (callback = (error) ->) ->
 			if @doc?
-				@ide.socket.emit 'joinDoc', @doc_id, @doc.getVersion(), (error, docLines, version, updates, ranges) =>
+				@ide.socket.emit 'joinDoc', @doc_id, { encodeRanges: true }, @doc.getVersion(), (error, docLines, version, updates, ranges) =>
 					return callback(error) if error?
 					@joined = true
 					@doc.catchUp( updates )
@@ -260,7 +260,7 @@ define [
 					@_catchUpRanges( changes, comments )
 					callback()
 			else
-				@ide.socket.emit 'joinDoc', @doc_id, (error, docLines, version, updates, ranges) =>
+				@ide.socket.emit 'joinDoc', @doc_id, { encodeRanges: true }, (error, docLines, version, updates, ranges) =>
 					return callback(error) if error?
 					@joined = true
 					@doc = new ShareJsDoc @doc_id, docLines, version, @ide.socket