2 * Button for marking all changes as seen on the Watchlist.
4 * @class mw.rcfilters.ui.MarkSeenButtonWidget
6 * @extends OO.ui.ButtonWidget
8 * @param {mw.rcfilters.Controller} controller
9 * @param {mw.rcfilters.dm.ChangesListViewModel} model Changes list view model
10 * @param {Object} [config] Configuration object
12 const MarkSeenButtonWidget = function MwRcfiltersUiMarkSeenButtonWidget( controller, model, config ) {
13 config = config || {};
16 MarkSeenButtonWidget.super.call( this, Object.assign( {
17 label: mw.msg( 'rcfilters-watchlist-markseen-button' ),
21 this.controller = controller;
25 this.connect( this, { click: 'onClick' } );
26 this.model.connect( this, { update: 'onModelUpdate' } );
28 this.$element.addClass( 'mw-rcfilters-ui-markSeenButtonWidget' );
35 OO.inheritClass( MarkSeenButtonWidget, OO.ui.ButtonWidget );
40 * Respond to the button being clicked
42 MarkSeenButtonWidget.prototype.onClick = function () {
43 this.controller.markAllChangesAsSeen();
44 // assume there's no more unseen changes until the next model update
45 this.setDisabled( true );
49 * Respond to the model being updated with new changes
51 MarkSeenButtonWidget.prototype.onModelUpdate = function () {
52 this.setDisabled( !this.model.hasUnseenWatchedChanges() );
55 module.exports = MarkSeenButtonWidget;