Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 1x 4x 4x 1x 1x 8x 1x 1x | /*! * VisualEditor DataModel rebase document state class. * * @copyright See AUTHORS.txt */ 'use strict'; /** * DataModel rebase document state * * @class * * @constructor */ ve.dm.RebaseDocState = function VeDmRebaseDocState() { /** * @property {ve.dm.Change} history History as one big change */ this.history = new ve.dm.Change(); /** * @property {Map.<number, Object>} authors Information about each author */ this.authors = new Map(); }; /* Inheritance */ OO.initClass( ve.dm.RebaseDocState ); /* Static Methods */ /** * @typedef {Object} AuthorData * @memberof ve.dm.RebaseDocState * @property {string} name * @property {string} color * @property {number} rejections Number of unacknowledged rejections * @property {ve.dm.Change|null} continueBase Continue base * @property {string} token Secret token for usurping sessions * @property {boolean} active Whether the author is active */ /** * Get new empty author data object * * @return {ve.dm.RebaseDocState.AuthorData} New empty author data object */ ve.dm.RebaseDocState.static.newAuthorData = function () { return { name: '', color: '', rejections: 0, continueBase: null, // TODO use cryptographic randomness here and convert to hex token: Math.random().toString(), active: true }; }; /* Methods */ ve.dm.RebaseDocState.prototype.getActiveAuthors = function () { const result = {}; this.authors.forEach( ( authorData, authorId ) => { if ( authorData.active ) { result[ authorId ] = { name: authorData.name, color: authorData.color }; } } ); return result; }; ve.dm.RebaseDocState.prototype.clearHistory = function () { this.history = new ve.dm.Change(); this.authors.forEach( ( authorData ) => { authorData.continueBase = null; } ); }; |