Constructor
new GlobalWatchlistSiteBase(globalWatchlistDebug, linker, config, api, watchlistUtils, urlFragment)abstract
#
Represents a specific site
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 |
- Source:
Returns:
Promise of api result
- Type
- Promise
afterMarkAllAsSeen()
#
Update display after making a site as seen
Overriden in GlobalWatchlistSiteDisplay
- 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 |
- 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 |
- 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' |
- 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 |
- 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 |
- 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 |
- 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
- 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 |
- 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.) |
- Source:
Returns:
Updated summary, with labels
- Type
- Promise
markAllAsSeen() → {Promise}
#
Mark a site as seen
- 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 |
- 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
Overriden in GlobalWatchlistSiteDisplay
Parameters:
Name | Type | Description |
---|---|---|
pageTitle |
string | Title of the page that was unwatched/rewatched. |
unwatched |
boolean | Whether the page was unwatched |
- Source:
renderApiFailure()
#
Used by GlobalWatchlistSiteDisplay
to still include an output for api failures
- Source:
renderWatchlist(summary)
#
Display the watchlist
Overriden in GlobalWatchlistSiteDisplay
Parameters:
Name | Type | Description |
---|---|---|
summary |
Array.<GlobalWatchlistEntryBase> | What should be rendered |
- Source: