this.newChangesExist = false;
this.nextFrom = null;
this.liveUpdate = false;
+ this.unseenWatchedChanges = false;
};
/* Initialization */
* @param {jQuery|string} changesListContent
* @param {jQuery} $fieldset
* @param {boolean} [isInitialDOM] Using the initial (already attached) DOM elements
- * @param {boolean} [fromLiveUpdate] These are new changes fetched via Live Update
+ * @param {boolean} [separateOldAndNew] Whether a logical separation between old and new changes is needed
* @fires update
*/
- mw.rcfilters.dm.ChangesListViewModel.prototype.update = function ( changesListContent, $fieldset, isInitialDOM, fromLiveUpdate ) {
+ mw.rcfilters.dm.ChangesListViewModel.prototype.update = function ( changesListContent, $fieldset, isInitialDOM, separateOldAndNew ) {
var from = this.nextFrom;
this.valid = true;
- this.extractNextFrom( $fieldset );
- this.emit( 'update', changesListContent, $fieldset, isInitialDOM, fromLiveUpdate ? from : null );
+ if ( mw.rcfilters.featureFlags.liveUpdate ) {
+ this.extractNextFrom( $fieldset );
+ }
+ this.checkForUnseenWatchedChanges( changesListContent );
+ this.emit( 'update', changesListContent, $fieldset, isInitialDOM, separateOldAndNew ? from : null );
};
/**
return this.liveUpdate;
};
+ /**
+ * Check if some of the given changes watched and unseen
+ *
+ * @param {jQuery|string} changeslistContent
+ */
+ mw.rcfilters.dm.ChangesListViewModel.prototype.checkForUnseenWatchedChanges = function ( changeslistContent ) {
+ this.unseenWatchedChanges = changeslistContent !== 'NO_RESULTS' &&
+ changeslistContent.find( '.mw-changeslist-line-watched' ).length > 0;
+ };
+
+ /**
+ * @return {boolean} Whether some of the current changes are watched and unseen
+ */
+ mw.rcfilters.dm.ChangesListViewModel.prototype.hasUnseenWatchedChanges = function () {
+ return this.unseenWatchedChanges;
+ };
}( mediaWiki ) );