GlobalWatchlistWatchlistUtils(linker)

GlobalWatchlistWatchlistUtils

Constructor

new GlobalWatchlistWatchlistUtils(linker) #

General helper for converting the api response data into the form we use to display

Parameters:

Name Type Description
linker GlobalWatchlistLinker

Linker for the relevant site, used for Links to user pages for registered users Links to contributions pages for anonymous users Converting links in edit summaries to not be relative to the current site

Source:

Methods

convertEdits(editInfo, groupPage) → {} #

Convert edit info, including adding links to user pages / anonymous users' contributions and grouping results by page when called for

Parameters:

Name Type Description
editInfo Object
groupPage boolean

Whether to group results by page

Source:

Returns:

Converted edits

Type

getFinalEntries(entries, tagsInfo, EntryClass) → {Array.<GlobalWatchlistEntryBase>} #

Do various cleanup of entries that goes after merging grouped edits and splitting edits and log entries. This is where we will convert the plain objects to the new classes in T288385.

  • Convert raw expiration strings into the tooltip to be shown.
  • Add a "flags" property to each entry that will either be false or a string with the flags to show next to the entry (new page, minor edit, bot action).
  • Truncate the timestamp to only show details down to the minute, see T262176. This needs to be done after the sorting of edits and log entries by timestamp, which should be done using the full untruncated version, see T286977.
  • Create the HTML to show for the tags associated with an entry. For each tag, if there is a display configured onwiki, that is shown, otherwise its just the name. See SiteBase#getTagList for where the info is retrieved.
  • Set the comment display to include the updated links in edit summaries/log entries. In fast mode, or for grouped changes, there is no comment display. The commentDisplay set here is treated as raw html by the display. We use the parsedcomment result from the api, and MediaWiki core takes care of escaping.

Parameters:

Name Type Description
entries

Entries to update

tagsInfo Object

Keys are tag names, values are the html to display (either the display text with local links updated, or just the name)

EntryClass function

either GlobalWatchlistEntryEdits or GlobalWatchlistEntryLog to convert entries to

Source:

Returns:

updated entries, each entry converted to either GlobalWatchlistEntryEdits or GlobalWatchlistEntryLog

Type
Array.<GlobalWatchlistEntryBase>

mergePageEdits(edits) → {Object} #

Convert an array of two or more objects for specific edits to the same page to one object with the information grouped

Parameters:

Name Type Description
edits

Edits to merge

Source:

Returns:

Merged information

Type
Object

normalizeEntries(entries) → {} #

Parameters:

Name Type Description
entries

Entries in the format returned by the api

Source:

Returns:

Entries in a "normalized" format

Type

rawToSummary(entries, groupPage, tagsInfo) → {Array.<GlobalWatchlistEntryBase>} #

Convert result from the API to format used by this extension

This is the entry point for the JavaScript controlling Special:GlobalWatchlist and the display of each site's changes.

Parameters:

Name Type Description
entries

Entries to convert

groupPage boolean

Whether to group results by page

tagsInfo Object

See details at #getFinalEntries

Source:

Returns:

summary of changes, each change converted to either GlobalWatchlistEntryEdits or GlobalWatchlistEntryLog

Type
Array.<GlobalWatchlistEntryBase>