This reverts commit 7e5f9b59a2.
Reason for revert: Causes empty state to always appear on wikis using Talkpageheader
Bug: T373100
Change-Id: I23a3f937201d93c7c7645a09c4fccfcf1c14008a
Record if a talk page is not empty, rather than empty.
This helps prevent Parsoid from mislabelling pages as empty when they
contain extension tags it needs to call out to the legacy parser to
process. Metadata from the legacy parse is merged into the overall
metadata for the page.
For example, a templatestyles extension tag parsed in the context of a
talk page would set the empty state which would then fail to cleared if
the overall parse of the page wasn't empty.
Bartosz (@matmarex) proposed this idea in T371125#10053043
Setting and using these flags all appear to be post-retrieval from
cache.
Alternative to I1deb679ef0e19dc3a36e377c183dd1b4ab0003e9
Bug: T371125
Change-Id: I5c1877f7f9eb73f88a33e001ca3c2f3d06bb90e4
I believe this makes the code less brittle, and also makes it a bit
more obvious what these strings are meant to represent.
Change-Id: I01adaff0ed75f792d1130bbc75e7840b3d044c54
Use
$this->getServiceContainer()
instead of
MediaWikiServices::getInstance()
in maintenance and tests.
Change-Id: I4066d7b2029296f1edb164acc5f8c812ccfba808
For example, in case nothing is ever called it's sometimes helpful to
use "NoOp" mocks to make this more visible.
There is also no actual OutputPage needed, just the much more narrow
interface.
Change-Id: I44522276726786abd75c85c02a7003c33a5602bb
I've been reading some discussions in Special:DiscussionToolsDebug
and saw a good number of comments where the first paragraph has
a bullet point (`*`), and the following paragraphs are indented (`:`).
Change-Id: I1afadc49565e843c97286a3744941ffb4062ddec
urldecode() should be used for decoding URL query parameters,
rawurldecode() should be used for decoding URL paths.
Bug: T367977
Change-Id: I7a7b14da85fb89f612c701d2746803d830017842
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: I492ddae3c3e9f81d551ea8b348b7148893f4f590
Not spotted in code search due to wrong case, which PHP forgives.
Whoops.
Bug: T360991
Depends-On: I73e4d3ab3158659b6a3c0a942f6bef10820b4248
Change-Id: I2d1cfd0f05c962f2d62dde911e4b0eed1ca02d83
MediaWiki's PHPCS plugin requires documentation comments on all
methods, unless those methods are fully typed (all parameters and
return value).
It turns out that almost all of our methods are fully typed already.
Procedure:
1. Find: \*(\s*\*\s*(@param \??[\w\\]+(\|null)? &?\$\w+|@return \??[\w\\]+(\|null)?)\n)+\s*\*/
Replace with: */
This deletes type annotations, except those not representable
as PHP type hints such as union types `a|b` or typed arrays `a[]`,
or those with documentation beyond type hints, or those on
functions with any other annotations.
2. Find: /\*\*/\n\s*
Replace with nothing
This deletes the remaining comments on methods that had no prose
documentation.
3. Undo all changes that PHPCS complains about (those comments
were not redundant)
4. Review the diff carefully, these regexps are imprecise :)
Change-Id: Ic82e8b23f2996f44951208dbd9cfb4c8e0738dac
We no longer need to support toggling visual enhancements without
reloading the page, so we can remove the extraneous set of buttons
to reduce HTML size.
Bug: T322457
Change-Id: I54e57c754c54b7e611069f9832d1ebabf141a396
In this case, the generated regexp would match the '/local' part in
the generated URL. Prefixing 'https://local' is no longer necessary
since 10899af666.
Add tests for this, and some tests to cover T261711 as well.
Bug: T358321
Change-Id: Idf54deba13f30b799b7b8d17de1897bc90f95701
Instead of setting global configuration variables, we create a custom
config object and all the other dependencies and pass them to the
CommentParser instead of the defaults.
Depends-On: I8d374b51511a2873dce646aa453c5e0e2c076a14
Change-Id: I9dfccc833d3e2695cf1d1f7bbee4b68eae9a8c25
Reasons:
* Various other methods dealing with ranges already live there
* It would be neat if ContentThreadItem was just a value class
without a lot of logic, similar to DatabaseThreadItem,
particularly for writing unit tests
* The methods access global state through Title, which can't
be fixed while they're in ContentThreadItem (see I9dfccc83)
The computation is now always done, instead of only when needed,
but that's a small drawback, since it's fast (fast enough that
I don't see the difference in the time taken when running tests),
and we were already computing it for all comments in many places.
Change-Id: Ic718a964e309ae3a8e15e299081f46d4db860731
It does the same as before.
I think performance is not a concern here, and wasn't my motivation
either. But I hope this makes the code easier to read and to reason
with.
I added a pure unit test case (without involving an actual Language
object) to cover the previously uncovered digits feature.
Change-Id: I6a0fc86035817eabb42b55e58183ae094c052aa6
Why:
- Code that interacts with DiscussionTools CommentFormatterTest may
expect a User object, instead of a UserIdentity, because OutputPage is
typed to return a User object
What:
- Change the mock to return User, not UserIdentity
Change-Id: I1354f5f8132fd0656f274cdf4f17cde7f93d9042
Why:
- The button should only display for Minerva
What:
- Consult the skin name before adding the "Edit" button to the menu
Bug: T342251
Change-Id: I52cf2ca0663a4de0ee7add82910e745bcabf1c5f
Why:
- Tests may invoke code that calls `getConfig` on the ContextSource
What:
- Mock the `getConfig` method
Follows-Up: I07b312b8c00f9b5d20e285874ed0a0153949dd18
Change-Id: I5c5b0d7cef24af108aeab461ba06b533eae4b739
Why:
- We want to allow extensions to register interactive menu items in the
overflow menu.
What:
- Create a PHP hook to allow extensions to provide menu items
for rendering in the overflow menu
- The hook allows for registering resource loader modules required by
the menu item
- The hook passes in some contextual information, like the thread
item data, context source object, and if the page is editable
- Create a JS hook that fires when a user selects one of the menu items
- Example implementation: Ie9afbedb4f24cbd75eb48bb21dc9f6d8d732d853
Misc:
- Remove b/c code that existed to handle a transitional period where
JSON encoded overflow menu data did not necessarily exist in the
parser cache
- Rename code instances of ellipsis button / data / menu to refer to
"overflow menu"
- Some renames will have to wait until parser cache is updated; these
are noted with TODOs
Bug: T342251
Change-Id: I5f2a51791f8ba7619d1399a4b93111e9bb44e172
Use mocks in CommentFormatterTest to avoid DB access, because the test
doesn't need it.
Add EventDispatcherTest to the Database group because it uses Parser,
whose DB access is hard to prevent.
Change-Id: Idfbf6c83a454f359e491e8c61e0629aad643d54f
* Add @var comments to untyped getService() calls so IDEs and tools
are able to understand where the callers are.
* Use the more specific IReadableDatabase where possible.
* Fix missing import.
Change-Id: I9c1153cb9fe872227753628a947f40bd5ee447fa
Special:DiscussionToolsDebug falsely promised that the API delivers
the same information, but in fact the API included the signatures in
each comment's HTML unconditionally. Allow excluding them.
Change-Id: Ie1e38d28bed0b6d5713d9051b84cc08a23da94c2