GlobalWatchlistSiteDisplay

GlobalWatchlistSiteDisplay

Extends

Constructor

new GlobalWatchlistSiteDisplay(globalWatchlistDebug, linker, config, api, watchlistUtils, urlFragment) #

Represents a specific site, including the display (used in jQuery display)

Parameters:

Name Type Description
globalWatchlistDebug GlobalWatchlistDebugger

Debugger instance to log to

linker GlobalWatchlistLinker

Linker instance to use

config Object

User configuration

api mw.ForeignApi

Instance of mw.ForeignApi for this site

watchlistUtils GlobalWatchlistWatchlistUtils

WatchlistUtils instance for this site

urlFragment string

string for which site this represents

Source:

Methods

actuallyGetWatchlist(iteration, continueFrom) → {Promise} #

Get the changes on a user's watchlist

This method calls itself recursively until there are no remaining changes to retrieve, using the continue functionality.

Parameters:

Name Type Description
iteration number

iteration count

continueFrom string

value of wlcontinue in the previous call

Inherited from:
Source:

Returns:

Promise of api result

Type
Promise

actuallyRenderWatchlist($content) #

Create the output for this.$feedDiv, either for success (via renderWatchlist) or failure (via renderApiFailure)

Parameters:

Name Type Description
$content jQuery

Content to show

Source:

afterMarkAllAsSeen() #

Update display after marking a site as seen

Overrides:
Source:

afterMarkPageAsSeen(pageTitle) #

Update display after marking a page as read

Overriden in GlobalWatchlistSiteDisplay

Parameters:

Name Type Description
pageTitle string

Page that was marked as read

Inherited from:
Source:

api(func, content, name) → {Promise} #

API handler for debugging and avoiding actual important actions when testing client-side

Parameters:

Name Type Description
func string

Function name

content Object

Content to send to the api

name string

Name, for logging purposes

Inherited from:
Source:

Returns:

Result of the api call

Type
Promise

changeWatched(pageTitle, func) #

Update the strikethrough and text for entries being watched/unwatched

Calls the API to actually unwatch/rewatch a page

Calls processUpdateWatched to update the display (either add or remove the strikethrough, and update the text shown)

If fast mode is not enabled, calls getAssociatedTalkPage to determine the talk/subject page associated with the one that was unwatched/rewatched, and then uses processUpdateWatched to update the display of any entries for the associated page

Parameters:

Name Type Description
pageTitle string

Title of the page to watch or unwatch

func string

Either 'watch' or 'unwatch'

Inherited from:
Source:

debug(msg, extraInfo) #

Shortcut for sending information to the debug logger

Parameters:

Name Type Attributes Description
msg string

Message for debug entry

extraInfo string optional

Extra information for debug entry

Inherited from:
Source:

error(msg, data) #

Shortcut for sending errors to the debug logger

Parameters:

Name Type Description
msg string

Message for error entry

data Object

Extra information for error entry

Inherited from:
Source:

getAssociatedPageTitle(pageTitle) → {Promise} #

Returns the talk/subject page associated with a given page, since entries for the associated page also need to have their text and strikethrough updated on unwatching/rewatching

Parameters:

Name Type Description
pageTitle string

Title of the page for which to retrieve the associated page

Inherited from:
Source:

Returns:

Promise of api result

Type
Promise

getTagList() → {Promise} #

Get the tags for a wiki, loading them if not already available (in fast mode we don't retrieve tags information for the watchlist, so this returns an empty object)

Once this is called once, the tag info is stored in this.tags and future calls with return early

Inherited from:
Source:

Returns:

Resolves with the tags that where retrieved, or an empty object if we are in fast mode

Type
Promise

getWatchlist(latestConfig) → {Promise} #

Get the rendered changes for a user's watchlist

Parameters:

Name Type Description
latestConfig Object

config, can change

Inherited from:
Source:

Returns:

Promise that the watchlist was retrieved

Type
Promise

makeWikidataList(summary) → {Promise} #

Fetch and process wikibase labels when the watchlist is for wikidata

Parameters:

Name Type Description
summary Array.<GlobalWatchlistEntryBase>

Original summary, with page titles (Q1, P2, L3, etc.)

Inherited from:
Source:

Returns:

Updated summary, with labels

Type
Promise

markAllAsSeen() → {Promise} #

Mark a site as seen

Inherited from:
Source:

Returns:

that resolves after the api call is made and after afterMarkAllAsSeen is called, not necessarily after the api call is finished.

Type
Promise

markPageAsSeen(pageTitle) → {Promise} #

Mark page as read

Calls the API to reset notification timestamp for a page

Parameters:

Name Type Description
pageTitle string

Title of the page to mark as read

Inherited from:
Source:

Returns:

that resolves after the api call is made and after afterMarkPageAsSeen is called, not necessarily after the api call is finished.

Type
Promise

processUpdateWatched(pageTitle, unwatched) #

Update entry click handlers, text, and strikethrough for a specific title

Parameters:

Name Type Description
pageTitle string

Title of the page that was unwatched/rewatched.

unwatched boolean

Whether the page was unwatched

Overrides:
Source:

renderApiFailure() #

Alert on API failures

Overrides:
Source:

renderWatchlist(summary) #

Display the watchlist

Parameters:

Name Type Description
summary Array.<GlobalWatchlistEntryBase>

What should be rendered

Overrides:
Source: