Followup to I3e48a9f2d9b70f0b9f6d7c6329db9c8e8001ee49
Reported in T174725#3590145
Comparing current value and active value with
different representation ("1" !== true) leads to
not applying filters that are ON by default.
Bug: T174725
Change-Id: If083610c0294756589adfc32a59388cc7422ad5d
CategoryMembershipChange is great, but it doesn't have a
machine-readable way to see if the category has been added or removed
from the page. We could parse the comments, but that would rely on
reading the comments and matching the message against the translated
strings.
This patch adds a couple of parameters and notes whether the change
was an addition or removal in rc_params.
Also, puts the evaluation of the AbortEmailNotification hook before
the check of rc_type in the hopes that the extension CatWatch can send
out emails at the right time.
Bug: T175052
Change-Id: I3e2ac0cc148b9d618e2f8b7853b14bff827ee443
Since the caller doesn't (and shouldn't) know whether CommentStore is
using the old or the new schema, it should leave truncation of comments
to CommentStore.
Change-Id: I92954c922514271d774518d6a6c28a01f33c88c2
* Respect different default values for 'limit' and 'day'
in RC and WL.
* Make 'latestrevision' respect 'watchlistextended'
Introducing 2 properties to ChangesListBooleanFilter
* activeValue: The value that defines when a filter is active.
Most filters are active when they are set to 'true' but
'extended' has no effect when it is 'true' and applies
filtering when it is set to false.
* isVisible: Whether this filter is visible anywhere.
'extended' is not visible in the legacy form but
it is activated from preference or URL. When
understanding form submission, it should not be assume
to be 'false' when not present in the request.
Bug: T171134
Change-Id: I3e48a9f2d9b70f0b9f6d7c6329db9c8e8001ee49
When the 'watchlistunwatchlinks' preference option is enabled, this
adds a '×' link to each entry of the watchlist that unwatches the page
of that entry. When clicked, it changes into a '+' which can be used to
re-watch the page (effectively undoing the earlier unwatch).
When a page is unwatched, its entries and the entries of its associated
talk page (or vice versa) become translucent and are struck through.
Without JS, '×'/'+' link to action=(un)watch for the relevant page.
In addition, ChangesList classes have been modified to allow a prefixer
that adds a prefix to each line (used in this case to put the unwatch
link) and to add HTML data attributes to reliably determine the target
page of each entry. Unit tests have been updated accordingly.
Bug: T2424
Change-Id: I450b2901413d7e75c11de2a446829fdbb22d31e1
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case passing by reference
Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
Reenable MediaWiki.WhiteSpace.SpaceBeforeClassBrace.NoSpaceBeforeBrace,
because the mentioned bug is fixed
Bug: T172933
Change-Id: I1593bdba2295ebed401b921f2beabed69dba7638
For both "Live Update" and "View newest changes", add a marker
between old and new groups when changes are grouped by page.
Bug: T163426
Change-Id: I00947d05e9b6022604a2a6b94eec94f6ed747c96
When "live update" is off and new changes are detected,
show a link to load and prepend the changes to the list.
Also adding a line between old and new changes
when grouping by pages is off.
Bug: T163426
Change-Id: I6a111d23956bdc04caa4c71e9deede056779aafa
And auto-fix all errors.
The `<exclude-pattern>` stanzas are now included in the default ruleset
and don't need to be repeated.
Change-Id: I928af549dc88ac2c6cb82058f64c7c7f3111598a
Having such comments is worse than not having them. They add zero
information. But you must read the text to understand there is
nothing you don't already know from the class and the method name.
This is similar to I994d11e. Even more trivial, because this here is
about comments that don't say anything but "constructor".
Change-Id: I474dcdb5997bea3aafd11c0760ee072dfaff124c
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
ChangesListStringOptionsGroup::modifyQuery checks for ALL and
behaves accordingly, but isSelected() didn't. This broke conflict
detection when an entire non-full-coverage group was selected.
Bug: T162630
Change-Id: Ie241744201380ca5450d5edbb3eba971194f3df4
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
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
Enhanced RCFilters: Add the ability to filter by namespaces to RCFilters.
🎉🎁🎊
- Add the ability to separate groups of filters by 'views'
- Add the first views as 'default' (for predefined filters)
and 'namespace' as the list of namespaces.
- Add 'nsinvert' to namespace group
- Allow highlighting namespaces
- Allow searching on either view, depending on prefix
- Add a way to switch views by typing prefix, clicking the
'Namespaces' button or clicking a tag (either namespace
or filter tag, changes the view accordingly, and adds
or removes the prefix from the input to stay consistent)
- Add an optional wrapper text for tags, so we can represent
them with their respective prefixes and (if needed) with
a special message for inverted state.
- Add unit tests and make pass
- Bonus: Fix issue with URL not updating (and not being updated)
the inverted and highlight enabled states.
Bug: T159942
Bug: T163521
Bug: T164130
Change-Id: I7e83f0800cbeb289dfd3461c1c5a197c053147ca
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
When all grouped changes were categorization, the formatted character
difference was an empty string. This resulted in doubled separator.
In this case, we need to change it to false (like the code already
did with log entries).
Change-Id: Ic5cd82426985285809858ed67967bb2529bc31cb
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
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
All the lists and sub-lists now render correctly,
and missing parameters have been added.
Bug: T163069
Change-Id: I7a8c95efaff7c844e32e4375dfe6af8c2e91923f
Filters are in conflict when their combination is guaranteed
to return no results. For instance: minor and log entries
is a conflict because major/minor does not apply to
log entries and the field is set to major by default.
Letting conflicts go through result in some very slow
database queries.
Bug: T160220
Change-Id: Ia6b0125c675c4a3cc4e4be4f83d1bd10d23059ba
Some legacy filters are replaced in structured UI by new filters.
It's important that their default value doesn't cause them
to filter the results when they are not even visible to the
user.
Bug: T162158
Change-Id: I3ff09164bbc0d14283302aa37bdee2c7ef9f5eb3
This is pretty fragile; it's easy to accidentally miss one of the
checks (as has already happened in e.g. parseParameters).
Although I don't yet know of any bugs as a result of this, it's
cleaner to do it at registration time.
There are no extensions using this feature.
Change-Id: I8547ea6432cae73e1bc272dbe959f2415b8a6d21
Explicitly block two filters in the same group from having the same
name.
Before, it would be left to registerFilter, which would just cause
the second one to win.
Also, avoid a getFilter warning when the filter does not exist.
Do the same for getFilterGroup on ChangesListSpecialPage
Finally, a minor related doc fix.
Change-Id: I6b3880a5c7cc381c169bbd969cd4814559b49c91
This is reserved for the client-side which joins 'someGroup'
and 'somefilter' to make 'someGroup__somefilter' as an internal
ID.
Change-Id: I1b6ca9f337dd48e10705c46ef5027c3156254e01
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
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
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
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.
Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
Follows-up 39a6e3dc4d. Class-based feeds are always given their parameters
by RCFeed::factory. However because the old getEngine() method insists
on creating its own object, the constructor parameters were not given.
Add it as optional parameter and pass it through there.
This is backwards-compatible still because before the 39a6e3dc4d refactor,
an RCFeedEngine also was not given information about any formatter and it
was the callers responsibility to format the line before calling send().
CentralAuth still uses it this way and that works fine. The core-caller
that expected the construction parameters since 39a6e3dc4d is hereby fixed.
The test couldn't catch this because it constructed the class instance there,
since PHPUnit does not support a mock class that is instantiated by foreign
code, and the parameter is passed there.
Bug: T156996
Bug: T157106
Change-Id: I83433cf57b6e040cdb69f3ad8807a999c4f931a5
Previously:
* Engines had to be registered in $wgRCEngines.
* The RCFeedEngine classes took no constructor arguments and
were expected to send whatever text is previously formatted
without any information about it. This generic design was
flexible in allowing one to use any formatter with any engine
with minimal configuration and no need for additional classes.
* Each feed configured their destination by setting a 'uri'
option that encodes the name of the engine in PHP as the uri
scheme. Other uri components had to be used for any other
parameters to the engine (host, port, path). While fairly
limited, it was sufficient for the default engines in core.
Changes:
* Allow feed classes to be directly associated with a feed in $wgRCFeeds
via a new 'class' option - without the indirection of 'uri' and
$wgRCEngines. All options are passed to the given class constructor.
This matches the design used elsewhere in MediaWiki. (ObjectCache,
FileRepo, FileBackend, JobQueue, LBFactory, etc.)
This means we no longer enforce a 1:1 mapping of internet protocols
to a specific feed engine, and it allows settings to be passed
without being encoded as a URI neccecarily.
Main use case for this refactor is EventBus (see I7edc4d57fa),
Interestingly, this matches the (then incorrect) documentation
written for $wgRCFeeds in 2961884b43 (which mentions an 'engine'
property that would do the same thing).
* Move the default 'omit' filters and unrestricted 'formatter' handling
to a new FormattedRCFeed class, which remains the default.
* Deprecate RecentChange::getEngine() in favour of RCFeed::factory().
* Document wgRCEngines as "@since 1.22". Follows 2961884b43, ffc71cb6af.
Change-Id: I8be497c623c5d928762e3d3406a388f4d91add9a
Use of &$this doesn't work in PHP 7.1. For callbacks to methods like
array_map() it's completely unnecessary, while for hooks we still need
to pass a reference and so we need to copy $this into a local variable.
Bug: T153505
Change-Id: I8bbb26e248cd6f213fd0e7460d6d6935a3f9e468
The old code was similar to Message::params(), but Message::params()
was unable to handle "special" parameters and received an overhaul
in 7f2663f, yet wfMessage remained broken. To avoid duplication,
wfMessage shall call Message::params() to correctly handle these
parameters.
CategoryMembershipChange::getChangeMessageText and its caller has
been updated so as not to take advantage of this bug.
Bug: T153747
Change-Id: I6667acf7e71c9db07fefc9fbb741c160e15823ff
Since T106119, moves that overwrite a redirect produce a deletion log
entry. It should be possibleto identify such deletions within other ones.
Note that this patch only applies for actions in the future because there
is no way to easily identify these cases for the software (until now).
Bug: T145991
Change-Id: I3c006bca57351d82031c4fdce0c53f65d630b0d9
This creates a hook triggered when updating change tags, so that
extensions can take actions when tags are updated.
When tagging accompanies the action, the recent change is passed
while when tagging is subsequent to the action, the user who
performs the tagging is passed.
Bug: T118698
Change-Id: Ifb0cdc43252c4185e4f216d23b8a21fb31595a37
Most planned callers of RecentChange::addTags() only want to add a
single tag, so forcing them to create an array seems unfriendly. Plus
this lets us avoid a array_merge call.
Change-Id: If001ba9ff01a33be158e7edd5c5e4de9825fa180
Currently, extensions that add tags within the recentchanges_save
hook directly call ChangeTags::addTags. This often results in
consecutive writes to the changetags table.
This provides a addTags method to RecentChange so extensions
can simply use it when they want a tag added. And all the actual
tagging is done once at the end.
Change-Id: I8df2fd983c12632337e8d2922fa357808482338c
Simplify DB callers by just having one code path.
All but some very old code paths bothered with these.
Change-Id: Iaf7a2f83146a0ed15995f9cfc74edcf16ae5a448
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.
The old constant is an alias now.
Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
These were added to Special:RecentChanges in 2004, but it doesn't
match what we do in any of the other lists. For accessibility
purposes, in flow indexing is preferred these days, or alternatively
a JS controlled roving tabindex, but this was neither.
Bug: T116127
Change-Id: Id455fafe4bdea40fb5988bdec14eed672844c8e3
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
If a hidden category has a member added or removed
this will only be shown to users that have the user
preference "display hidden categories".
Also added method to WikiCategoryPage to check
for hidden status.
Added unit tests for both.
Bug: T127944
Change-Id: Ic53d51391fa29d5e18fef4c42b8a275816c7ba4a
Per the docs of unserialize:
In case the passed string is not unserializeable, false is returned.
Also as we can not guarentee an array was serialized in
rc_params we cant say it will always be an array...
Quite often this is just an empty string which will
result in: "s:0:"";" (not an array)....
Change-Id: Ib22f9f7468a23ce3d4f145d47f8514d08be6c957
Providing the perfectly correct number of pages
that have acctually been added to or removed from a
category is extermly hard.
Rather than providing data that is most likely wrong
and a bit useless ONLY provide a link to Special:WhatLinksHere.
This touches on the following bugs and may mean that
some of them don't need to be thought about any further.
Bug: T126855
Bug: T126407
Bug: T126139
Change-Id: Ida06d822d1955091595c17c9c6c2968a40a93bcd
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
This patch addes the summarized number of category changes
for grouped category changes on the EnhancedChangesList.
Bug: T126849
Change-Id: I3c8ccb2ad6310dac19a724b2ce923c1e67e588be