mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-13 18:37:07 +00:00
d5376e28fc
Change-Id: Ia266fc22b02af0edbb32f356b4e0d92fe3a4da5f
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
var ThreadItem = require( './ThreadItem.js' );
|
|
|
|
/**
|
|
* @external moment
|
|
*/
|
|
|
|
/**
|
|
* A comment item
|
|
*
|
|
* @class CommentItem
|
|
* @extends {ThreadItem}
|
|
* @constructor
|
|
* @param {number} level
|
|
* @param {Object} range
|
|
* @param {Object[]} [signatureRanges] Objects describing the extent of signatures (plus
|
|
* timestamps) for this comment. There is always at least one signature, but there may be
|
|
* multiple. The author and timestamp of the comment is determined from the first signature.
|
|
* The last node in every signature range is a node containing the timestamp.
|
|
* @param {moment} [timestamp] Timestamp (Moment object)
|
|
* @param {string} [author] Comment author's username
|
|
*/
|
|
function CommentItem( level, range, signatureRanges, timestamp, author ) {
|
|
// Parent constructor
|
|
CommentItem.super.call( this, 'comment', level, range );
|
|
|
|
this.signatureRanges = signatureRanges || [];
|
|
this.timestamp = timestamp || null;
|
|
this.author = author || null;
|
|
|
|
/**
|
|
* @member {string[]} Comment warnings
|
|
*/
|
|
// TODO: Should probably initialise, but our tests assert it is unset
|
|
// this.warnings = [];
|
|
|
|
/**
|
|
* @member {ThreadItem} Parent thread item
|
|
*/
|
|
this.parent = null;
|
|
}
|
|
|
|
OO.inheritClass( CommentItem, ThreadItem );
|
|
|
|
module.exports = CommentItem;
|