ChangesList: Expose basic properties of lines as data attributes
authorGergő Tisza <gtisza@wikimedia.org>
Fri, 10 Feb 2017 05:31:32 +0000 (05:31 +0000)
committerGergő Tisza <gtisza@wikimedia.org>
Thu, 8 Jun 2017 23:19:45 +0000 (23:19 +0000)
commit016452cd09f4b32100f4fa3740168c5fc161d496
treea4391e1fe0104d168394a219b3c418e0f5b13af5
parentc721668afa07cf25c32ffa7c2f3fb9b2ef2c0b92
ChangesList: Expose basic properties of lines as data attributes

We have several types of change lists (old RC/watchlist/related
changes, enhanced RC/watchlist, history) with slightly different
HTML, each with their own idiosyncracies. JavaScript code trying
to identify lines by log ID / revision ID has to jump through all
kinds of hoops to work with that.

To simplify the lives of frontend / gadget maintainers and provide
something approaching an API for these pages, we now expose the basic
attributes of each change line (revision ID for edits, log type/action
and ID for log events) as data attributes.

The OldChangesListRecentChangesLine, EnhancedChangesListModifyLineData,
EnhancedChangesListModifyBlockLineData, PageHistoryLine,
ContributionsLineEnding and DeletedContributionsLineEnding hooks
are updated accordingly. New hooks (LogEventsListLineEnding and
NewPagesLineEnding) are added for the change list pages which did
not yet have them.

Change-Id: I6dd006d0b1b0fd35c0020f0f9eea9113eca30b35
17 files changed:
RELEASE-NOTES-1.30
docs/hooks.txt
includes/GlobalFunctions.php
includes/Sanitizer.php
includes/actions/HistoryAction.php
includes/changes/ChangesList.php
includes/changes/EnhancedChangesList.php
includes/changes/OldChangesList.php
includes/logging/LogEventsList.php
includes/specials/SpecialNewpages.php
includes/specials/pagers/ContribsPager.php
includes/specials/pagers/DeletedContribsPager.php
includes/templates/EnhancedChangesListGroup.mustache
tests/phpunit/includes/GlobalFunctions/wfArrayFilterTest.php [new file with mode: 0644]
tests/phpunit/includes/SanitizerTest.php
tests/phpunit/includes/changes/EnhancedChangesListTest.php
tests/phpunit/includes/changes/OldChangesListTest.php