(changeset: any, author: any, apool: any)
| 210 | } |
| 211 | |
| 212 | _extendChangesetWithAuthor(changeset: any, author: any, apool: any){ |
| 213 | // unpack |
| 214 | const unpacked = unpack(changeset); |
| 215 | |
| 216 | const assem = new OpAssembler(); |
| 217 | |
| 218 | // create deleted attribs |
| 219 | const authorAttrib = apool.putAttrib(['author', author || '']); |
| 220 | const deletedAttrib = apool.putAttrib(['removed', true]); |
| 221 | const attribs = `*${numToString(authorAttrib)}*${numToString(deletedAttrib)}`; |
| 222 | |
| 223 | for (const operator of deserializeOps(unpacked.ops)) { |
| 224 | if (operator.opcode === '-') { |
| 225 | // this is a delete operator, extend it with the author |
| 226 | operator.attribs = attribs; |
| 227 | } else if (operator.opcode === '=' && operator.attribs) { |
| 228 | // this is operator changes only attributes, let's mark which author did that |
| 229 | operator.attribs += `*${numToString(authorAttrib)}`; |
| 230 | } |
| 231 | |
| 232 | // append the new operator to our assembler |
| 233 | assem.append(operator); |
| 234 | } |
| 235 | |
| 236 | // return the modified changeset |
| 237 | return pack(unpacked.oldLen, unpacked.newLen, assem.toString(), unpacked.charBank); |
| 238 | } |
| 239 | _createDeletionChangeset(cs: any, startAText: any, apool: any){ |
| 240 | const lines = splitTextLines(startAText.text); |
| 241 | const alines = splitAttributionLines(startAText.attribs, startAText.text); |
no test coverage detected