@@ -100,6 +100,7 @@ module.exports = function (sequelize, DataTypes) {
100100 var startContent = null ;
101101 var lastPatch = [ ] ;
102102 var applyPatches = [ ] ;
103+ var authorship = [ ] ;
103104 if ( count <= Math . round ( revisions . length / 2 ) ) {
104105 // start from top to target
105106 for ( var i = 0 ; i < count ; i ++ ) {
@@ -112,6 +113,7 @@ module.exports = function (sequelize, DataTypes) {
112113 applyPatches = applyPatches . concat ( patch ) ;
113114 }
114115 lastPatch = revision . patch ;
116+ authorship = revision . authorship ;
115117 }
116118 // swap DIFF_INSERT and DIFF_DELETE to achieve unpatching
117119 for ( var i = 0 , l = applyPatches . length ; i < l ; i ++ ) {
@@ -130,12 +132,14 @@ module.exports = function (sequelize, DataTypes) {
130132 var revision = revisions [ i ] ;
131133 if ( i == l ) {
132134 startContent = LZString . decompressFromBase64 ( revision . lastContent ) ;
135+ authorship = revision . authorship ;
133136 }
134137 if ( revision . patch ) {
135138 var patch = dmp . patch_fromText ( LZString . decompressFromBase64 ( revision . patch ) ) ;
136139 applyPatches = applyPatches . concat ( patch ) ;
137140 }
138141 lastPatch = revision . patch ;
142+ authorship = revision . authorship ;
139143 }
140144 }
141145 try {
@@ -145,7 +149,8 @@ module.exports = function (sequelize, DataTypes) {
145149 }
146150 var data = {
147151 content : finalContent ,
148- patch : dmp . patch_fromText ( LZString . decompressFromBase64 ( lastPatch ) )
152+ patch : dmp . patch_fromText ( LZString . decompressFromBase64 ( lastPatch ) ) ,
153+ authorship : authorship ? JSON . parse ( LZString . decompressFromBase64 ( authorship ) ) : null
149154 } ;
150155 var ms_end = ( new Date ( ) ) . getTime ( ) ;
151156 if ( config . debug ) {
@@ -218,7 +223,8 @@ module.exports = function (sequelize, DataTypes) {
218223 Revision . create ( {
219224 noteId : note . id ,
220225 lastContent : note . content ,
221- length : LZString . decompressFromBase64 ( note . content ) . length
226+ length : LZString . decompressFromBase64 ( note . content ) . length ,
227+ authorship : note . authorship
222228 } ) . then ( function ( revision ) {
223229 Revision . finishSaveNoteRevision ( note , revision , callback ) ;
224230 } ) . catch ( function ( err ) {
@@ -244,7 +250,8 @@ module.exports = function (sequelize, DataTypes) {
244250 noteId : note . id ,
245251 patch : LZString . compressToBase64 ( patch ) ,
246252 content : note . content ,
247- length : LZString . decompressFromBase64 ( note . content ) . length
253+ length : LZString . decompressFromBase64 ( note . content ) . length ,
254+ authorship : note . authorship
248255 } ) . then ( function ( revision ) {
249256 // clear last revision content to reduce db size
250257 latestRevision . update ( {
0 commit comments