Commit graph

73 commits

Author SHA1 Message Date
Roan Kattouw
11f9d532b4 EnhancedChangesList: Don't render headings for empty days
EnhancedChangesList renders an <h4> for every day, but it
does so before it starts rendering the changes for that day.
If all of the changes for a different day fail to render
(due to permissions issues, extension hooks, or whatever)
this would result in an empty heading.

Instead, render the heading after formatting is complete,
so that if all changes for a given day are dropped,
the heading is also dropped.

Bug: T171078
Change-Id: I8a0c6cbd679976d18d2c2e6e9ac972fb7b294a42
2017-07-20 11:38:52 -07:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
Umherirrender
be42e09aa8 build: Prepare for mediawiki/mediawiki-codesniffer to 0.9.0
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168

Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||

Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
2017-06-26 17:14:31 +00:00
jenkins-bot
246bc1a78d Merge "Fix enhanced RC data attribute sanitizing" 2017-06-21 19:38:48 +00:00
jenkins-bot
7bb26739ec Merge "Add a message to localize strings like "2×" and use it in enhanced RC" 2017-06-19 18:50:35 +00:00
Gergő Tisza
94749fa62e Fix enhanced RC data attribute sanitizing
We push 'class' in the attribute array so the hook
can manipulate it, so it needs to be added to the attribute
whitelist as well.

Broken in I6dd006d0b1b0fd35c0020f0f9eea9113eca30b35.

Bug: T167922
Bug: T167535
Change-Id: Ic24400382a9dcbb990e12dfddae4ab7db14553cc
2017-06-15 00:02:44 +00:00
Gergő Tisza
016452cd09 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
2017-06-08 23:19:45 +00:00
Matěj Suchánek
0da36c5cab Add a message to localize strings like "2×" and use it in enhanced RC
Change-Id: I4fb651347a45f30e26bb6a49a565013fa91797ad
2017-06-06 08:50:25 +02:00
jenkins-bot
eb56a9255a Merge "Fix EnhancedChangesList::getDiffHistLinks null exception" 2017-05-21 12:28:57 +00:00
Brian Wolff
07fcf9909f Fix EnhancedChangesList::getDiffHistLinks null exception
If a page is deleted, rc_cur_id is missing, but it takes
a while before job queue deletes RC entries. If we encounter
something like that, just skip it since its bound for
deletion anyways.

Bug: T164059
Change-Id: I286109a9707e54939c0da31656ef54fd29acf481
2017-05-21 08:50:44 +00:00
Kunal Mehta
52a63f01b5 EnhancedChangesList: Use one TemplateParser instance
TemplateParser has an instance cache to avoid reading from APC
repeatedly for the same template, but that only works if the code uses
the same TemplateParser object.

Noticed while investigating T163154.

Change-Id: I645895a0965f7150e9a5aebc5a7788f27aa5a26d
2017-05-16 15:43:35 -07:00
Matthew Flaschen
aa063f4c5a Back-end of new RecentChanges page, refactoring
Generate old RC, Related changes (it was already displayed and working
on 'Related changes' before this change), and Watchlist/etc. and data
for new UI from back-end.

This moves everything used for defining the old (unstructured) and new
(structured) filters into unified objects, ChangesListFilter and
ChangesListFilterGroup (and sub-classes).

This includes the query logic (see below) and logic for adding
CSS attribution classes.

This is a breaking change (for subclasses of ChangesListSpecialpage)
due to the signature (and name) change of buildMainQueryConds and
doMainQuery.  An alternative that I don't think is a breaking change
would be to put the filter->DB logic in runMainQueryHook, but then it's
doing more than just running a hook.

This is because it used to only build $conds here, but it's clear from
filterOnUserExperienceLevel filters need more than this.  I added all
the DB parameters from the hook, but this could be debated.

I have an checked and fixed the WMF-deployed extensions affected by
this.

Other than that, there should be full back-compat (including legacy
filters not using the new system).

* add hidepatrolled/hideunpatrolled to new UI.

* Move userExpLevel from RC to ChangesListSpecialPage.  Although for
now the structured UI only displays on RC anyway, when it displays on
watchlist, it seems we'll want userExpLevel there.

  Change this to make 'all' exclude unregistered users.

* Don't have front-end convert none-selected to 'all' on string_options.

* Needs the hideanons/hideliu special redirect to be done before this
is merged (T151873)

Bug: T152754
Bug: T152797
Change-Id: Iec2d82f6a830403d1c948a280efa58992e0cdee7
2017-03-11 01:42:01 +00:00
Eddie Greiner-Petter
6a60a90ffb Add CSS classes for diff/hist links at Enhanced RC
CSS classes mw-changeslist-diff and mw-changeslist-history should be
added to diff and history links in recent changes. There is already a
patch for the old recent changes page, this one adds the same classes
onto the enhanced recent changes page (class EnhancedChangesList). As
enhanced RC has a lot more links, this patch introduces two new css
classes for some links, one named  #mw-changeslist-diff-cur which is for
the diff that links to a current version within nested changes and the
other named #mw-changeslist-groupdiff which is for the 'summary diff'
that appears for a group of nested changes.
Follow-up: I2d5ef8c180ae4ff6e7f5d0ab443dc7084f8c4c77

Bug: T157178
Change-Id: Ib51639a92b5925f2bad0aebd4f7068b178f65017
2017-03-02 17:41:31 +00:00
Stephane Bisson
029dc81f41 RC Filters: in enhanced RC mode, don't highlight groups
Change-Id: I560c6e11d95cf82453d3af68eb194fa876975687
2017-02-28 14:21:19 -05:00
Stephane Bisson
09e441003b RCFilters UI: Highlight behavior
Let there be highlight! and there were highlights
And RCFilters separated the highlight from the darkness
And it defined highlights as five colors
The lights are called yellow and green, and the darks red and blue
And there were colors and there were circles; one highlight.

This is the commit that adds highlight support for filters both in the backend
and the UI. The backend tags results based on which filter they fit and the
front end paints those results according to the color chosen by the user.
Highlights can be toggled off and on.

Also added circle indicators to the capsule items and each line of results
to indicate whether the line has more than one color affecting it.

Bug: T149467
Bug: T156164
Change-Id: I341c3f7c224271a18d455b9e5f5457ec43de802d
2017-02-23 10:58:56 -08:00
amir
49b39049dd Make classes actually work in lines in EnhancedChangesList
Change-Id: I2a1dc712d735077dd3741aa0d066933a81c4e568
2016-07-08 09:48:23 +00:00
amir
1a54516530 Let EnhancedChangesListModifyLineData Hook change classes as well
Change-Id: I7c2ae57bd3b18c26b12dd36e331deb6af5fa36c2
2016-06-15 11:39:27 +02:00
Kunal Mehta
53ccc289fa ChangesList: Use LinkRenderer instead of Linker::link()
Change-Id: Iae32a9e365aad268d2671df6a0b916e4d9c0a801
2016-05-26 14:47:45 -07:00
aude
4ae160aac7 If $line is empty in EnhancedChangesList, don't try to access parts of array
In getLineData, if the EnhancedChangesListModifyLineData hook returns false,
then $line is an empty array and recentChangesFlagsRaw is not set.

If $line is empty then presumably we don't want to render it and
can skip the line here.

Bug: T133296
Change-Id: I92fded07274a06a0dd2929b97815bfe56f1847ea
2016-05-04 15:57:06 +00:00
matejsuchanek
82b5a3cdf3 Kill obsolete check
Was a temporary fix for T126428 and was added in
c940fa8ec1.

Change-Id: Iad988f69068147cdc24c8829627875274540b16e
2016-04-17 09:20:49 +00:00
amir
78f109bfdd Generalize recentChangesFlags rollup
Flags can be either 'any' or 'all' type, and both core and extension flags will be
rolled up into the top-level line of grouped changes.

See Ic49a355a2

Bug: T120921
Bug: T112856
Change-Id: If9fd6af3ac7ac2fbee9aa5536fe94d7574699966
2016-04-02 18:02:20 +04:30
WMDE-Fisch
b536c129cf Adding number of changes info for grouped category changes
This patch addes the summarized number of category changes
for grouped category changes on the EnhancedChangesList.

Bug: T126849
Change-Id: I3c8ccb2ad6310dac19a724b2ce923c1e67e588be
2016-03-15 21:19:17 +00:00
jenkins-bot
207a47a1fe Merge "Add mw-changeslist-(log|ns)-* class to OldChangesList as well" 2016-02-29 08:25:50 +00:00
jenkins-bot
a85d1b9d0c Merge "rc_old/new_len null for CategoryMembership RC change" 2016-02-18 23:45:50 +00:00
Glaisher
d3e12637d6 Add mw-changeslist-(log|ns)-* class to OldChangesList as well
Bug: T111666
Change-Id: I880c86f318710f179e60ed42c65081514757c6a0
2016-02-18 22:33:53 +05:00
addshore
c940fa8ec1 rc_old/new_len null for CategoryMembership RC change
This will mean that EnhancedChangesList does not
do odd things.
Log changes also have this set to null

This also adds a tiny bit of cleanup for the past which
could be removed in a month or 2.
This will fix all current RC entries as well as new ones.
Once no old RC entires for CategoryMembership changes exist
we can kill the type check.

Bug: T126428
Change-Id: Ib19819373af70e10b0c750ffdb06156764b7fa3d
2016-02-18 16:09:30 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Adam Roses Wight
de8f8c8248 Use template to render EnhancedChangesList groups
Rewrite a chunky HTML string concatenation party as Mustache template
rendering.  This decouples the view from the controller.

Bug: T120921
Change-Id: I3217b80168f89e7b91dbc33a7053865ad3408615
2015-12-28 20:09:11 +00:00
Adam Roses Wight
23f436ee77 Clean up recentChangesFlags rollups
Move ad-hoc variables under an array, in preparation for merging with
RC flags implemented by extensions.

Bug: T120921
Change-Id: I5dd91ba5e5ed36785d9fbf01673defcd227c8b01
2015-12-09 09:53:33 +00:00
Kunal Mehta
56a9ae8d28 Fix diff/history links not showing up for ungrouped enhanced RC
Looks like a typo or accident from d40cd42b9f.

Bug: T116899
Change-Id: I33b65afa78480612b9312282922686a64346fef2
2015-10-28 13:48:46 -07:00
jenkins-bot
682e2b9c6b Merge "Enable users to watch category membership changes #2" 2015-10-20 21:41:16 +00:00
addshore
d40cd42b9f Enable users to watch category membership changes #2
This is part of a chain that reverts:
e412ff5ecc.

NOTE:
- The feature is disabled by default
- User settings default to hiding changes
- T109707 Touching a file on wikisource adds and
      removes it from a category... Even when page
      has no changes.... WTF? See linked issue,
      marked as stalled with a possible way forward
      for this patch.
      @see https://gerrit.wikimedia.org/r/#/c/235467/

Changes since version 1:
- T109604 - Page names in comment are no longer
      url encoded / have _'s
- T109638 & T110338 - Reserved username now used
      when we can't determine a username for the change
      (we could perhaps set the user and id to be blank
      in the RC table, but who knows what this might do)
- T109688 - History links are now disabled in RC....
      (could be fine for the introduction and worked
      on more in the future)
- Categorization changes are now always patrolled
- Touching on T109672 in this change emails will never
      be sent regarding categorization changes. (this
      can of course be changed in a followup)
- Added $wgRCWatchCategoryMembership defaulting to true
      for enabling / disabling the feature
- T109700 - for cases when no revision was retrieved
      for a category change set the bot flag to true.
      This means all changes caused by parser functions
      & Lua will be marked as bot, as will changes that
      cant find their revision due to slave lag..

Bug: T9148
Bug: T109604
Bug: T109638
Bug: T109688
Bug: T109700
Bug: T110338
Bug: T110340
Change-Id: I51c2c1254de862f24a26ef9dbbf027c6c83e9063
2015-10-20 14:23:48 -07:00
addshore
304a56f7d8 Add recentChangesLine to ChangesList
This method is implemented in all sub classes.

Not having this method here looks odd as
ChangesList::newFromContext returns a ChangesList
and parts of the code base then call recentChangesLine
on that object which may not exist..

In the future we might even have some interface here?

Change-Id: Iad00a956862c078a2bcaf3ef0602abcf3fedb7d2
2015-10-13 20:19:16 +01:00
Matthias Mullie
c9fedd8fc0 Don't attempt to render block if none of the lines can be shown
Not only doesn't it make sense to render this, getLogText has
some assumptions about this array, and an empty array just didn't
work.

Bug: T112738
Change-Id: Ibdc0c4ed15449883a91a3292bfa174ff84116be0
2015-09-23 13:28:03 +02:00
jenkins-bot
ac17fbac94 Merge "When aborting EnhancedRC block line, block should reflect that" 2015-09-16 11:00:33 +00:00
Matthias Mullie
e39bd385b2 When aborting EnhancedRC block line, block should reflect that
It was possible to abort the rendering of all block lines, but
the block would still be rendered (with nothing inside). It
would also render a "x changes" link, even though that "x" is
no longer correct.

This had been reverted in adba11dfe3,
but has now been fixed up.

Change-Id: Ic5d15e56bc2f46fa6aa8c9375f3cafeb13e1ea9c
2015-09-16 12:46:44 +02:00
jenkins-bot
266dbe55e8 Merge "Revert "When aborting EnhancedRC block line, block should reflect that"" 2015-09-16 10:12:02 +00:00
Catrope
adba11dfe3 Revert "When aborting EnhancedRC block line, block should reflect that"
Caused errors when there were two new topics created on the
same Flow board on the same day.

BadMethodCallException from line 496 of
/srv/mediawiki/php-1.26wmf23/includes/changes/EnhancedChangesList.php:
Call to a member function getTitle() on a non-object (NULL)
{"exception_id":"58b04b8c"}

This reverts commit b30417048b.

Bug: T112738
Change-Id: Ib404d78eaf1aa9ac7ea34516183bcc9956efc515
2015-09-16 09:56:57 +00:00
jenkins-bot
7b0df4e549 Merge "When aborting EnhancedRC block line, block should reflect that" 2015-09-10 00:21:44 +00:00
CSteipp
e412ff5ecc Revert "Enable users to watch category membership changes"
This reverts commit f6879ea16e.

Bug: T109638
Change-Id: I770d8d33a4cff3829bdea9a4df24de209cbe691b
2015-08-20 10:35:56 -07:00
Kai_WMDE
f6879ea16e Enable users to watch category membership changes
Bug: T9148
Change-Id: I5a89d8f19804b1120f4c755d834e2da6ca12ceae
2015-08-13 17:58:06 +02:00
Kunal Mehta
a220d8b830 Unbreak missing flags in enhanced RC
$this->recentChangesFlags() was being called on the data twice, so the
second time it was processing the string, causing the flags go missing.

Follows-up 94f153db6a.

Bug: T105237
Change-Id: I04465d0317eecc1c12e47bc9a74f11986eba99a4
2015-07-08 14:57:20 -07:00
Matthias Mullie
b30417048b When aborting EnhancedRC block line, block should reflect that
It was possible to abort the rendering of all block lines, but
the block would still be rendered (with nothing inside). It
would also render a "x changes" link, even though that "x" is
no longer correct.

Change-Id: I94ae68e80461dcfbf328683522ea6cb58c6c5753
2015-07-08 17:11:55 +02:00
Matthias Mullie
dc3ddcc4a2 Allow hooks to abort lines in EnhancedRC
Bug: T104564
Change-Id: I4a2f97d83f38071984d571773a6b09b6b6643d6d
2015-07-03 10:18:58 +02:00
Matthias Mullie
94f153db6a Add hook EnhancedChangesListModifyBlockLineData
Introduce a new hook to allow (single) block-level entries.
Very similar to EnhancedChangesListModifyLineData.

Bug: T104399
Change-Id: I6b4715277d44e5f09d7a230b33e956676aeab1c2
2015-07-03 10:16:52 +02:00
Stephane Bisson
28f2fe8a22 Add 'EnhancedChangesListModifyLineData' hook
Gives extensions a chance to modify the data used to
build each enhanced recent change 'inner' lines
(as opposed to the header lines).

Bug: T102021
Change-Id: Ia8a796fb9621db14d6574e66a4572e1fdf3bad03
2015-06-26 12:51:55 -07:00
umherirrender
70f3afd548 Remove unneeded empty lines at begin of if/else/foreach body
An if body must not begin with an empty line

Change-Id: I62b058be337fcc85a120fcd3dadce564db59a271
2015-06-19 20:05:45 +02:00
Matthias Mullie
fd64488787 Add hook EnhancedChangesList::getLogText
Enhanced RC generates these "(3 changes | history)" links for
every block of grouped recentchanges. That changes-link links
to a diff page.

For Flow, that is all wrong: we have different ids (not integers),
on a different page (&curid=&oldid=&diff= means nothing). Even
the concept of a "diff" page seems wrong here for us - a new post
is not part of some document that can be diffed.
In short: we'll want to generate a different link, and we'll need
a hook to let us change them.

Meanwhile also split the code that generates those links into a
separate method.

Bug: T72513
Change-Id: Ib32fb9552b80f9581d89b3b47da6e5d32e3d84a3
2015-03-03 01:50:32 +00:00
Ricordisamoa
2ae155da52 Fix phpcs errors in includes/
Mostly Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines

Change-Id: I678b2f0902f11cd1dfa1611b9da24e7237df9122
2015-01-08 20:15:07 +01:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00