Commit graph

255 commits

Author SHA1 Message Date
Derick Alangi c1c1cee267 Hooks: Remove injecting MainConfig to ParsoidHelper
Will fallback to MainConfig gotten from services in VisualEditor.
VE will remove this complete soon.

Depends-On: I787c0afb227308aab56770d14d62e08eb0084a6c
Change-Id: I4b9e7362a1bf1b4f224c8c652d40851a18c19824
2022-09-05 14:36:25 +01:00
jenkins-bot 2ce1822484 Merge "Use cheaper getRawVal/getCheck instead of getVal where possible" 2022-09-03 05:33:08 +00:00
Thiemo Kreuz 62ddb8bceb Use cheaper getRawVal/getCheck instead of getVal where possible
getVal/getText can be expensive because they do Unicode normalization.
We can skip this when we know we aren't going to do anything meaningful
with the value anyway.

Change-Id: I9d939a44df6b67bcd8429096d89600ce1566ca39
2022-09-03 05:27:20 +00:00
Bartosz Dziewoński 14b01e101a Only hold on to a Config instead of ConfigFactory when injecting
The config is currently unused in some classes, but this is okay since
it might be used in the future.

Change-Id: Ie25fc52cc5d3476c9445e182975d229991316bd3
2022-09-03 00:39:51 +02:00
jenkins-bot 5326f060de Merge "Notify users when a topic they are subscribed to is removed from a page" 2022-08-30 15:59:33 +00:00
Bartosz Dziewoński d33996f8b4 Notify users when a topic they are subscribed to is removed from a page
In the future the notifications can be improved to look up
the new location of the comment, using the permalinks data.

Depends-On: Ia8a21749a8edc20f34b2a3e445278ea6922b9109
Bug: T299657
Change-Id: I5f5e7b73fb84ff0d31fb8260b24066a17da71628
2022-08-25 03:52:58 +02:00
Bartosz Dziewoński 434944b197 Enhance vector-2022 table of contents
Bug: T307823
Depends-On: I034a579b7ef51950726c9ac056d6c940a7d7d472
Change-Id: Icafc13e1c846549429fe2b3b4a1721c02ab7428d
2022-08-23 19:46:44 +00:00
Ed Sanders 9adafd43a1 Show latest comment info in subtitle
Bug: T306675
Change-Id: I1400dbb50cdf8a0a5e23ce533c84fad96f3fae16
2022-08-23 19:31:40 +00:00
Bartosz Dziewoński a0647956de Make visualenhancements_pageframe features respect visualenhancements preference
Follow-up to I481e885b54a1aeb9dd69a08dc614ab5f4f94b41e.

Change-Id: Ia62a8b4441371956457a40117e8f4d05cdf2cb1c
2022-08-22 20:48:41 +02:00
Bartosz Dziewoński c52980dd7f Always use English for internal exceptions
Change-Id: I3d18fef2dfd28bbad9f01b83b018c25886f63265
2022-08-19 22:23:29 +02:00
Ed Sanders 0e95e45e88 Add space after namespace on talk pages
Bug: T313636
Change-Id: I481e885b54a1aeb9dd69a08dc614ab5f4f94b41e
2022-08-18 16:02:27 +01:00
jenkins-bot 01882fe1ce Merge "Prevent using the reply tool together with Convenient Discussions gadget" 2022-08-17 03:24:40 +00:00
Bartosz Dziewoński ee4e75cbf5 Add try…catch in failing deferred update
This code is throwing exception for as yet uncertain reasons, which
may cause other updates to not be executed (e.g. Echo notifications).
Put a try…catch around it while we investigate.

Bug: T315383
Change-Id: Ic7aba32369f69c2e8165d5d6d25687a4cb6e0be8
2022-08-17 02:18:44 +02:00
Bartosz Dziewoński e6fff19e7e Prevent using the reply tool together with Convenient Discussions gadget
Parts of the implementation copied from the Popups extension.

Bug: T298909
Change-Id: I2c42c6ff1c5d84da9333f8f74a4aec5c8fea704b
2022-08-17 01:40:43 +02:00
jenkins-bot 95fb33fb57 Merge "Store permalink data, implement Special:FindComment/GoToComment" 2022-08-11 17:11:44 +00:00
jenkins-bot 1eb59a6682 Merge "Avoid dependency on Minerva for the mobile "Add topic" button label" 2022-08-11 13:43:57 +00:00
Bartosz Dziewoński 0024a94ba7 Store permalink data, implement Special:FindComment/GoToComment
Depends-On: I90656cc74bb1cb1f2f3c82ad51cfb164cb8a4a4b
Bug: T296801
Change-Id: I84187b303aa10a242c872088403f808df3d1f940
2022-08-11 01:19:47 +02:00
Bartosz Dziewoński d9ccb115e4 Don't display the empty state if the subject page or user doesn't exist
Bug: T288319
Bug: T312560
Change-Id: Ib069b2db639a699f7e28ffc24f7b196971acbe3e
2022-08-06 14:15:32 +00:00
Bartosz Dziewoński 69848614f8 Bring back [reply] links in old revisions without breaking preview
It turns out that using the "enableSectionEditLinks" post-cache
transform option was not a good idea, as it is also set when viewing
old revisions and in some other cases.

However, in the pre-cache parsing, we have access to getIsPreview(),
which is exactly what we want. I think we can safely do this there.
We were already using that prior to 2bc76dabd7.

Bug: T314260
Change-Id: I7f769db48eff9fa434483902a4b5ac2f5fc96b3d
2022-08-02 21:57:44 +02:00
Bartosz Dziewoński 0868d40cbf Avoid dependency on Minerva for the mobile "Add topic" button label
We might want to delete the code that defines it in the future.

The core message is the same in most translations, and available in
100+ more languages.

Change-Id: I230e051940fdd7b89989453eccbffac804a7ddea
2022-08-02 00:58:14 +02:00
Bartosz Dziewoński f7606ffa57 Fix reply buttons not being available on mobile
Change-Id: Ie78f66e61c7afc4b9d2310b11d84cf26f28a52e6
2022-08-02 00:32:24 +02:00
Ed Sanders 980b2c38bc Make reply links into buttons when visual enhancements enabled
Bug: T255560
Bug: T309904
Change-Id: I3932f576086a43df89ff97a1b3dafdc27c54f71c
2022-08-01 20:59:53 +02:00
Ed Sanders fcdd6b0ed5 Don't show empty page state on redirect pages
Add the redirect check to shouldShowNewSectionTab.

Try to run cheaper checks before more expensive ones.

Depends-On: I5755863243d8ad336ad20626f439d70eb3b31f32
Bug: T312599
Change-Id: I6848e529a2537d4058613db0c3b900bc9f4f59f8
2022-07-29 00:15:42 +02:00
Bartosz Dziewoński e1499c0291 More consistently handle new topic tool vs empty state
We had different logic for the empty state on pages that exist and
those that don't. For the second case, we relied on the new topic tool
becoming unavailable in some cases, but that could cause complications
elsewhere (e.g. if the page also had a custom button to add a new
section).

The new topic tool is now available regardless of the page. Instead,
the empty state is controlled separately, by the same method in both
cases.

As far as I can tell, the effect is exactly the same as before.

Change-Id: I5b36e6f027cf76dd0e3a8ee3cb5156fe1eaac8a8
2022-07-28 02:16:07 +02:00
Bartosz Dziewoński 34e755c623 Don't show new topic tool empty state on existing non-talk pages
Bug: T312599
Change-Id: Ie691498f7b89cb34a414cb8dfae9337f1b706685
2022-07-28 01:57:32 +02:00
jenkins-bot 131f00c464 Merge "Add topic containers HTML to parser cache even when feature is disabled" 2022-07-27 19:19:48 +00:00
Ed Sanders 5e2b209314 Add topic containers HTML to parser cache even when feature is disabled
Remove hacks marked as 'TEMPORARY' now that we consider the
HTML to be stable enough.

This will avoid issues with HTML/CSS being out of sync in future deployments.

Bug: T313560
Change-Id: Ie00ff38a422f241add19d500adaf22dfeee10e8c
2022-07-27 17:26:33 +01:00
Ed Sanders 06d14d8c8f Visual enhancements: Fix loading of icons
* clock, userAvatar, speechBubble were dropped before topic
  containers was merged
* Load ellipsis & edit icons on mobile only
* Load bell & bellOutline for topic subscriptions button

Change-Id: I77d1336627b564be756e3ec50b4686b8f9ac72dc
2022-07-27 18:24:54 +02:00
Ed Sanders 2960853088 Move subscribe button up on desktop
Bug: T312674
Change-Id: I419883b5f9a4291b4bf575d57195d553fd5e291e
2022-07-27 13:55:03 +01:00
jenkins-bot d35ff76d81 Merge "Don't enable visual enhancements CSS on mobile when feature is "unavailable"" 2022-07-12 00:26:22 +00:00
Ed Sanders f739160fb4 Fix infinite recursion when checking for the new topic tool on empty pages
Bug: T312689
Change-Id: Iaf5033a55e3840ef65be0c4994f8b6c00fe2551b
2022-07-09 12:48:17 +01:00
Ed Sanders 09a84e81e5 Don't enable visual enhancements CSS on mobile when feature is "unavailable"
Bug: T312683
Change-Id: Ifa66a62f335b5c2eee9c59284a0f4b851a83b94b
2022-07-08 22:42:39 +01:00
Bartosz Dziewoński 2bc76dabd7 Enable transformations in preview mode
We remove the [reply] and [subscribe] links when they should not be
visible (controlled by 'enableSectionEditLinks' option, which is
disabled when previewing).

Bug: T309423
Change-Id: Ie0d3fba2c4d166daac3ea2e117a246c9584284ca
2022-07-07 23:37:56 +01:00
Bartosz Dziewoński a98cd369ba Show new topic tool empty state on existing pages with no topics too
Bug: T312599
Change-Id: I316d2f119b9c899ffaeebc7ec288823c826db092
2022-07-07 21:45:44 +00:00
Ed Sanders eab257e3a0 New topic tool: Always disable when "Add topic" is not visible
Bug: T312210
Change-Id: I2c9eafccf5d240fdaf711be6ed1d2e4a0a11d673
2022-07-06 13:59:41 +01:00
Ed Sanders b1be63469b Only enable visual enhancements in specific namespaces
Change-Id: I91643d3f07a9ee6f03a18f8e2787ab9cb61bc41d
2022-06-24 16:15:07 +01:00
Ed Sanders da64c43ccc Show thread metadata in section headers
Bug: T269950
Change-Id: Ifa47ddcbccf288be0bbecd5961eab7c5122aab7b
2022-06-23 17:17:09 +01:00
Ed Sanders 1f002f812f Convert more self:: to static::
These are from patches that were already in progress before
we did the first run of conversions.

Change-Id: Id883e693a518130cfcc80bfd0f2874cbd9593446
2022-06-14 22:53:00 +01:00
jenkins-bot cb17181fa4 Merge "Prefer late static binding over self::" 2022-06-09 16:29:48 +00:00
Ed Sanders af54bae2ec Prefer late static binding over self::
While in many cases the class will never be sub-classed, it's easier
just to always use static:: and not worry about predicting which
classes might have problems in the future.

Change-Id: I23072a1701b5acf62bb3379a877de97627d8fcf3
2022-06-09 15:12:48 +01:00
jenkins-bot 636ff45a75 Merge "TagHooks: Make static method for obtaining DiscussionTools tags" 2022-06-08 11:18:42 +00:00
na1307 edb276e047
Show createpage preference only when feature is available
Bug: T310053
Change-Id: I13262ecbe2d2c45c0ffb8706da17bc806ab2a5b7
2022-06-07 18:59:15 +09:00
jenkins-bot b6abc80c35 Merge "Add preference for offering new topic tool when creating new talk pages" 2022-06-06 23:01:40 +00:00
Bartosz Dziewoński e0f231b892 Add preference for offering new topic tool when creating new talk pages
Depends-On: I46a8eaf331e86de0c8c94f0f60bdc4b5be6dd83a
Bug: T297990
Change-Id: Iaf6677affe5d0b7f6047bce55c0a575286c8e676
2022-06-06 17:09:50 +00:00
Kosta Harlan bf161db768
TagHooks: Make static method for obtaining DiscussionTools tags
Bug: T309839
Change-Id: I30697ca56d4aa346151c4d31850f545d32399305
2022-06-03 12:46:16 +02:00
jenkins-bot f460ce39bc Merge "Add attributes for Minerva click tracking" 2022-06-02 15:29:50 +00:00
Bartosz Dziewoński 02ced052db Disable (instead of hiding) preferences that would have no effect
Keeping them visible avoid the page shifting unpleasantly,
and makes it easier to find the option you're looking for.

Change-Id: I1e37d5d11c5a19beb799346f4e9842e836224d3a
2022-06-01 21:36:30 +02:00
Bartosz Dziewoński 28124e7f1e Add attributes for Minerva click tracking
Bug: T295490
Change-Id: I05fa96280c8dacc801b071d22086568ee0f11d86
2022-05-27 03:55:09 +02:00
David Lynch b6f554a945 Ready A/B test code for topic subscriptions
Topic subscription test is going to be all logged in users only, no
transitory enrollment conditions, so we can remove the anonymous user
handling and DB writes.

Bug: T302515
Bug: T304030
Change-Id: I5e57bb9b7958576f3a04373748331a86f4626fb5
2022-05-19 01:09:40 -05:00
Umherirrender a979257396 Replace Action::getActionName by IContextSource::getActionName
Change-Id: If681252727a161d62444c8edbcd0cf447df1e765
2022-04-15 22:52:30 +02:00
Ed Sanders 91446d790e Empty state: Use self closing Html generators
Change-Id: I5352b064ac9e71df9f3f8791139944126b321436
2022-04-08 18:30:48 +01:00
Reedy 400d6227b8 Use namespaced VisualEditor traits and classes
Change-Id: I06eefd96068675607ed66a8a307d86c24d21f916
2022-03-29 20:32:44 +01:00
jenkins-bot 6948f0b3f3 Merge "Move cache expiry update from ParserAfterParse to ParserAfterTidy" 2022-03-15 21:44:44 +00:00
C. Scott Ananian 8e09b67c0d Move cache expiry update from ParserAfterParse to ParserAfterTidy
The ParserAfterParse hook will likely be deprecated, as Parsoid can't
properly support it as-is.  Luckily, DiscussionTools isn't doing
anything in ParserAfterParse that couldn't happen in the (supported)
ParserAfterTidy hook.

Bug: T303630
Change-Id: If72feb1e277c09f4ea0df339f2dd097a9b329d71
2022-03-15 12:19:57 -04:00
Bartosz Dziewoński 109f49bb56 Mobile: Only show "Add discussion" button if "New section" tab would be shown on desktop
Bug: T302417
Change-Id: Icd2acf19b8b7e4cf8893bbb37f80eafefe86acbb
2022-02-23 18:05:01 +01:00
Bartosz Dziewoński e11beee2ad Fix check for enabling features on mobile
When 'DiscussionToolsEnableMobile' was false, we were falling back to
the desktop configuration, rather than disabling everything.

When 'DiscussionToolsEnableMobile' was true, we were enabling the
selected features on every page, instead of only discussion pages.

Follow-up to b4f10c5638.

Bug: T302388
Change-Id: Ib4a42d5acd9da528e931c74de7a870d4be513d69
2022-02-23 12:05:00 +00:00
Ed Sanders b4f10c5638 Mobile config: Always enable reply/newtopic tools on mobile, disable subscriptions
Bug: T302326
Change-Id: I64ffc904046f7d9d2fa651c086876add35061e0a
2022-02-22 23:24:28 +01:00
David Lynch 7094cc592c Don't autosubscribe flagged bots
Bug: T301933
Change-Id: Icabee260a16ed2686a95250bad2aa1b92881566e
2022-02-17 11:54:14 -06:00
jenkins-bot 8bcaf75372 Merge "Replace use of deprecated OutputPage::enableClientCache( false )" 2022-02-10 07:01:26 +00:00
Bartosz Dziewoński 8b6ffc945f Don't refer to non-existent fields when using 'hide-if'
Bug: T301317
Change-Id: I40577b41e0c957281a45b71802808ec535b65653
2022-02-09 15:38:47 +01:00
C. Scott Ananian fe35a7324c Replace use of deprecated OutputPage::enableClientCache( false )
Replaced with the more readable ::disableClientCache() method, added
in 1.38.  Minimum MW version for this extension is already at 1.38.

Depends-On: I7c89e20528a0d91173f0edcb997dcae631935ee5
Change-Id: Idf1cf2fac3311f50ed3cbc420f7772b5c71b1992
2022-02-04 14:30:33 -05:00
Ed Sanders 6d655dee0a Remove DiscussionToolsEnableTopicSubscriptionBackend config
This is now deployed on all wikis, and going forward I don't think
we need to make this configurable.

Change-Id: I231976267ba6cdfeec622efaa15983a84c330649
2022-02-04 18:22:10 +00:00
jenkins-bot 5181d099ab Merge "PreferenceHooks: Don't call saveSettings in LocalUserCreated" 2022-01-12 21:58:04 +00:00
Ed Sanders 34011b7a07 Parser: Pass in title of page being parsed
Will be used to parse selflinks in the future.

Change-Id: I2bc29d1c5c69cb6309f582f162f9af7d96ce8913
2022-01-12 21:17:59 +00:00
Kosta Harlan f9f1884ac3 PreferenceHooks: Don't call saveSettings in LocalUserCreated
$user->saveSettings() happens in AuthManager after the LocalUserCreated
hook finishes running.

Bug: T199393
Change-Id: Ic661dbe1ffaa3a5438373a33c10ad3053662d932
2022-01-12 19:21:17 +01:00
jenkins-bot 6c5461d858 Merge "Treat user talk subpages like normal talk pages in empty state text" 2022-01-12 17:04:21 +00:00
jenkins-bot 6b31c89159 Merge "Ignore the beta feature setting when enrolling in the A/B test" 2022-01-12 01:59:04 +00:00
jenkins-bot ecd649f6e2 Merge "Allow logged out users to be enrolled in the A/B test" 2022-01-12 01:58:50 +00:00
David Lynch 893290d4b4 Ignore the beta feature setting when enrolling in the A/B test
We realized that any change made to Special:Preferences will set the
beta preference even if they didn't visit the beta tab, so we can't
actually tell if manual intent was involved. As such, we'll enroll
people regardless of their beta setting -- they can disable the feature
through regular preferences if they want, and that'll be respected.

Bug: T291307
Change-Id: I8c1cbf51060012e8e68af252da84944dfcc681d8
2022-01-10 18:10:50 -06:00
David Lynch 2f1e2f80e0 Allow logged out users to be enrolled in the A/B test
For logged out users we store their test state and an anonymous
identifier in local storage. So long as the test is enabled, we include
these in any logging that occurs.

This is done entirely client-side, to avoid any cache issues caused by
state depending on cookies from PHP for logged out users.

Bug: T291307
Change-Id: Ib39e2f2146cdfdac9df5690ee3de75718f0f2731
2022-01-10 18:10:50 -06:00
Bartosz Dziewoński d0dd6b3f73 Treat user talk subpages like normal talk pages in empty state text
Bug: T298454
Change-Id: I0b95f87fe934dcb7d233265b0a41956ed8f3c143
2022-01-03 16:36:08 +01:00
Bartosz Dziewoński d0eec56f6d Show a hint on legacy interface when arriving from new topic tool hint
Bug: T293962
Change-Id: I56823efb4e58839b3f121ff23d576984b86e4e81
2021-12-16 17:43:23 +00:00
David Lynch f24a73a05a Show a hint on the new topic tool to explain that it's new
This shows to users who are logged in and have more than 500 edits

Bug: T293962
Change-Id: Ic47fa897c6a4f43c27d4cfd5571e34f8acb01eb8
2021-12-16 16:01:38 +01:00
jenkins-bot f731b7a575 Merge "Update abtest bucketing for newtopictool usage" 2021-12-13 18:02:09 +00:00
David Lynch d228ca0f67 Update abtest bucketing for newtopictool usage
Trigger off the (absence of the) new preference for tracking topic tool
usage.

Change the name of the bucket preference so anyone who was enrolled in
the prior abtest won't find themselves re-enrolled.

Update the abtest enrollment code so it explicitly sets the preference
for the feature. This is a trade-off -- it does mean that we'll need to
special-case *unenrollment* once the abtest is disabled if we want to
just quietly revert people to the wiki's default, but it also means that
Special:Preferences will be accurate.

Bug: T291307
Change-Id: I659679e05b65fc7db05e249114e5a7de4cf55816
2021-12-13 18:45:37 +01:00
jenkins-bot 7dcb0ef4cf Merge "Revert "Split DiscussionToolsEnableMobile=true into 'behind-overlay' and 'remove-overlay'"" 2021-12-10 16:10:02 +00:00
Ed Sanders c71ca91171 Cache page properties in memory to avoid extra queries
Bug: T297132
Change-Id: I157c85bd905bf518cdf3d9da1d7504b3c0fb1475
2021-12-07 22:54:16 +00:00
Esanders 3cbca26bd0 Revert "Split DiscussionToolsEnableMobile=true into 'behind-overlay' and 'remove-overlay'"
This reverts commit 99b757465a.

Reason for revert: We may never need the 'behind-overlay' setting
and it is untested and probably broken.

Bug: T295816
Change-Id: I9e128862271697ece5241d0e98727174b42f54ff
2021-12-06 17:26:01 +00:00
Ed Sanders 8e4f08182e Add missing typehints
Change-Id: Ia25c5bea1834a3fdd26f32a9d5ed097789329824
2021-12-01 14:57:09 +00:00
Bartosz Dziewoński a38e1941e3 Cast 'discussiontools-betaenable' preference to bool
Bug: T296138
Change-Id: Ifff81ec330c3eb447c79f2b176654e7852d671dd
2021-11-22 20:08:55 +01:00
jenkins-bot e479c28459 Merge "First-run experience popup for automatic topic subscriptions" 2021-11-16 01:39:46 +00:00
Bartosz Dziewoński 9adbbccad8 Auto topic subscriptions disabled by default, enabled only for new users when out of beta
Bug: T294398
Change-Id: I909caaebbb976624a16f15361d4ee232007ff506
2021-11-15 23:36:03 +00:00
Bartosz Dziewoński 9ded06a655 First-run experience popup for automatic topic subscriptions
Bug: T262103
Change-Id: I9f9336718ad060d553146c4e27604565ce5822c6
2021-11-15 22:45:42 +01:00
Bartosz Dziewoński 0d57aa9762 Automatic topic subscriptions (on any edit)
Bug: T284836
Change-Id: Ia42ad087218fd91a0cdd1664157d1049738e3c01
2021-11-15 22:45:42 +01:00
David Lynch bd40523843 Set a user preference to record whether the new topic tool has been used
This will be used for an upcoming A/B test.

Bug: T294167
Change-Id: I494b0b3cf3ae568bec2b9cef80aeb22306896769
2021-11-15 10:25:51 -06:00
Bartosz Dziewoński 99b757465a Split DiscussionToolsEnableMobile=true into 'behind-overlay' and 'remove-overlay'
Bug: T295490
Bug: T295491
Bug: T280051
Change-Id: I1b96b0a22eec9e364c2ecbe8b734cebd0d157b96
2021-11-10 22:24:07 +01:00
jenkins-bot 3861aadbb3 Merge "Add links to Special:TopicSubscriptions in preferences" 2021-11-07 12:10:44 +00:00
Bartosz Dziewoński 312cce03db Add links to Special:TopicSubscriptions in preferences
Bug: T294994
Change-Id: Ifd564f435e300232d220896e5a29bd8f43db326c
2021-11-04 19:51:08 +01:00
Ed Sanders de4d4bfb21 Support new topic tool on mobile
* Use featuresEnabled.newtopictool to decide when new topic
  links might exist on the page, instead of relying on
  `#ca-addsection` existing. Change the logic of that feature
  flag to check if __NONEWSECTIONLINK__ is on the page.
* Render the add-topic button locally in a hook to replace
  the one suppressed by onMinervaNeueTalkPageOverlay. Do so
  whenever the newtopictool feature is enabled (see above).

Bug: T270537
Change-Id: I3e3f7403b3b86bb84fcb75a8833919512519b70f
2021-11-04 18:19:40 +00:00
David Lynch 7588a393e4 Use MinervaNeue hook to disable talk overlay if DT mobile enabled
Bug: T280051
Change-Id: I6a52adcfd8030b26649b609ca99902ff840e8fdf
2021-11-04 16:46:42 +00:00
Ed Sanders 900a01772f Support reply tool on mobile
Bug: T270536
Change-Id: I94d04e9cd442f9a4e0c5924da67c43a768417a8b
2021-11-03 17:49:06 +00:00
Bartosz Dziewoński 98bba62e5d Add [reply] link brackets during postprocessing after parser cache
This should avoid them showing up in unexpected contexts where parser
output is used (e.g. API T292345, search T294168, action=render).

Also rename some variables to be directionality-neutral.

Bug: T292345
Bug: T294168
Change-Id: Ibcac44ee10f0842e205d9dd9a7f3a935ce0c690b
2021-10-26 19:55:09 +00:00
Bartosz Dziewoński 884d1f6ec6 Move body classes code to BeforePageDisplay hook
Seems like a better place and it avoids duplication.

Change-Id: I26643c42cb7aa19cf0dfae449347f2fec2f8bc61
2021-10-26 17:42:39 +02:00
Bartosz Dziewoński 695a966a41 Remove unused non-parser-cache mode
Change-Id: Ief9f4153898b09a1ce15ccfdc8656dfad4642269
2021-10-07 17:59:10 +02:00
Bartosz Dziewoński dbb8b00ec7 Remove parser cache splitting ('dtreply' option)
Bug: T280599
Change-Id: I08b52874d575619308b5b83a39acfb6353c5b7b5
2021-10-07 17:59:10 +02:00
Bartosz Dziewoński e3af0bc65b Replace marker comment with limit report data
We always do our processing in the parser now, so we don't need the
marker comment to detect whether we've already processed the page.

Bonus: include the time taken by our processing in the limit report.

Bug: T291831
Change-Id: Ife7ddffbad1b1495b004739212002a98fdebe6c0
2021-10-07 17:59:10 +02:00
Alexander Vorwerk b73f4b1a70 Replace usage of deprecated PageProps::getInstance()
Bug: T289544
Change-Id: Ib4d86c298508b3dc56c44a4fa7314218f8a0d930
2021-09-26 00:48:51 +00:00
jenkins-bot abd6c2fedd Merge "Enhance Echo user talk edit and mention notifications" 2021-09-24 02:17:57 +00:00
jenkins-bot 02a214d928 Merge "Put all checks for enabling the empty state for talk pages in one place" 2021-09-21 15:43:11 +00:00
Bartosz Dziewoński 4a824abd0d Apply page transformations only when viewing pages
Follow-up to e634701460. We didn't need
this previously, because we relied on the ArticleParserOptions hook
only being called when viewing pages.

Context from code reviews a year ago:
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/+/641837/comment/15ee0218_e4ab602f/
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/+/641837/comment/b62d4327_5ebc2e02/

Bug: T291459
Bug: T291460
Change-Id: I64f0be170719d874f5460934462917f4f13af6c1
2021-09-21 10:19:42 +02:00
Bartosz Dziewoński ca17555a67 Put all checks for enabling the empty state for talk pages in one place
They were spread across several places, and some of them were checking
different things, causing us to show the view mode on some
action=edit&redlink=1 links but without showing our empty state.

Bug: T291085
Change-Id: Id1864e58c47dbd22abb41d48e31f81318d9f94f9
2021-09-20 23:15:00 +02:00
jenkins-bot 152a663fb6 Merge "Always apply DiscussionTools page transformations" 2021-09-20 17:30:43 +00:00
Bartosz Dziewoński 435b0c65c7 Enhance Echo user talk edit and mention notifications
If the user talk edit or mention coincides with exactly one new comment:
* Change the primary link to be a direct link to the comment
* Add a text snippet to notifications that don't already include one
  (user talk edits that are not new sections).

This is done for all such notifications, regardless of whether anyone
has topic subscriptions enabled.

Bug: T281590
Bug: T253082
Change-Id: I98fbca8e57845cd7c82ad533c393db953e4e5643
2021-09-20 15:05:42 +02:00
David Lynch 46b6d76433 Enable email delivery for our notifications for new users by default
We're using the same approach as Echo is for its new-users-only settings

Bug: T287547
Change-Id: I1d8fff364da919caaf86af94cf5f0c6e40b67ff9
2021-09-15 23:54:30 -05:00
Bartosz Dziewoński e634701460 Always apply DiscussionTools page transformations
Bug: T273072
Bug: T280599
Change-Id: I0b39ef2f9ede15905951a54c043dd228bd5ace9f
2021-09-08 00:16:30 +02:00
Bartosz Dziewoński ce899aaadd Inject services in hook handlers where possible
Change-Id: Ie5c36cabd90412d2299b00d2b0c3c3bdf9ffc6d6
2021-09-07 22:51:35 +02:00
Bartosz Dziewoński 23d2255111 HookUtils: Remove unused variable
Change-Id: I3f8aec349a5845b3ea4d08d3257937467497f2a2
2021-09-03 19:13:34 +00:00
David Lynch 21600231d9 Empty states for anon/IP user talk pages
Bug: T287779
Bug: T288556
Change-Id: I9d01d1ac04c0cc443c4cbfe94d301db16f5b1ef6
2021-08-26 22:11:13 +02:00
Bartosz Dziewoński 3e19fce67a Load styles in ParserOutput too
We load them in OutputPage, because we need that to handle the
query parameter 'dtenable=1', but do it here as well just in case
the pages are somehow shown without involving OutputPage.

Per code review:
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/+/713681/1/includes/Hooks/ParserHooks.php#90

Change-Id: I3f287a9e146de7fd4d37c47dfa47eeb03eeb8cf1
2021-08-20 18:49:04 +02:00
jenkins-bot ccd2769b17 Merge "Remove remnants of the cookie hack for loading unavailable tools" 2021-08-19 16:32:10 +00:00
jenkins-bot 52ff6ef77e Merge "HookUtils: Simplify check for your own talk page" 2021-08-19 16:32:07 +00:00
Bartosz Dziewoński c8fa10770a Remove remnants of the cookie hack for loading unavailable tools
Follow-up to ee524d6bd6.

Change-Id: I1b4dc587e6b629b05ca0581dcd384a2bc7f01d2a
2021-08-18 20:45:02 +02:00
Bartosz Dziewoński 75d63bb056 Remove repetition in "Discussion pages" preferences
Bug: T289187
Change-Id: Id6c90546e4b57754e13b55f7c61610b51de87966
2021-08-18 20:20:34 +02:00
Bartosz Dziewoński 4aca61990a HookUtils: Simplify check for your own talk page
This approach is used in our new topic tool empty state code and is
much nicer. Also fix typo in a comment nearby.

Change-Id: I80755ef0960a172b0f370c36c1979a86498d6fa9
2021-08-17 22:22:15 +02:00
Bartosz Dziewoński ad04b24ffd Create a hidden revision tag for talk page comments
Bug: T262107
Depends-On: I21159d03eebaf46ad94f4273ba698a59b8019185
Change-Id: Iceddfaf6a4bcc5e8b5c85c8cd5638bf14aa7db03
2021-08-16 15:42:51 +00:00
vladshapik 613b0a9b27 Avoid using deprecated ParserOptions::getUser
Bug: T287858
Change-Id: I13ef6ef128a8316f699c6e038adf82d18bf81b96
2021-08-10 16:43:11 +03:00
David Lynch 93f2e64f3f Only show the empty state on talk namespaces
This should only affect some edge cases like the project namespace (e.g.
Wikipedia:Village_pump isn't a talk page, but does get discussiontools.)

Bug: T288317
Change-Id: I509101063a1d64d09cff71a84bf48c69ab7a8c08
2021-08-06 16:04:23 -05:00
David Lynch 91af0594b5 Apply an empty-state to pages with the new topic tool enabled
This includes the dtrepliedto URL functionality from
I3f81e4d77faed367606e47678b8896051982359d.

Bug: T274831
Bug: T274832
Bug: T277329
Change-Id: I035d04f30c8312b0cb42902d3bf940df1482ffb3
2021-08-04 18:46:28 -05:00
Bartosz Dziewoński cfbf437d9d Allow the new topic tool to handle URLs like action=edit&section=new
Depends-On: Ib9302e2fda7dadf1edc43c0107db7234eb4bdf7a
Depends-On: Ic7dd677ea219938969f60bab91387c2e03ebdbe6
Bug: T282204
Change-Id: I2e7b2682da7beb3c1c469bb784a9a8ec3998aeb9
2021-07-30 09:25:21 +02:00
libraryupgrader b0884b177c build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* glob-parent: 5.1.1 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)

Change-Id: I7a71e23da561599da417db3b3077b78d91173bbc
2021-07-22 16:29:04 +00:00
David Lynch ae0aeff3a3 Allow dtenable=0 to disable DiscussionTools
Bug: T285578
Change-Id: Ic722285d51ea1a51593ab63fac516b4f992eb1c8
2021-06-29 21:20:35 +00:00
jenkins-bot b6b60bbe0b Merge "Config option to enable topic subscriptions backend and dtenable=1 URL parameter" 2021-06-29 15:21:09 +00:00
Bartosz Dziewoński 1517e2e094 Remove unused RL module
Unused since 6a24ceaeca.

Change-Id: I96c8a7d7f7527e86ed728e72eb7232406aeb6942
2021-06-15 12:34:18 +02:00
Bartosz Dziewoński 067f0c36de Config option to enable topic subscriptions backend and dtenable=1 URL parameter
…without making the topic subscriptions feature available in user preferences.

Follow-up to these commits, which added these checks in ad-hoc ways:
* 9420f22e9d
* f3422f40a6
* 23a490deca
* a555db7892

Bug: T284491
Change-Id: If2e3fb1e06d1cc489fbca14796ed77c83bb52991
2021-06-14 16:18:18 +02:00
Bartosz Dziewoński fd080b7043 Ensure you can't get duplicate notifs for edits to your user talk page
We don't display [subscribe] buttons on your user talk page,
but the API still allows those subscriptions.

Use the same approach as for mentions to ensure this doesn't cause
duplicate notifications.

Remove some code in SubscribedNewCommentPresentationModel,
now guaranteed to be unused.

Change-Id: I99a276a48d8562552ed2c54cc0323e8e428845fd
2021-06-03 02:10:33 +02:00
jenkins-bot ea98787f41 Merge "Apply transformations in ParserCache for all CommentFormatter features" 2021-06-01 19:24:04 +00:00
jenkins-bot 14035f3c7e Merge "Remove cookie hack for loading unavailable tools" 2021-05-25 19:17:19 +00:00
Bartosz Dziewoński ee524d6bd6 Remove cookie hack for loading unavailable tools
Bug: T277783
Change-Id: I521db842b4b7a98d8d255d418abd0ccb167c5aa0
2021-05-25 20:27:46 +02:00
Timo Tijhof 54eb6691fa Allow talk pages to have a different ParserCache expiry
Using `updateCacheExpiry()` in this way appears to be established
with examples of other use in WMF production such as:
- CategortyTree extension:
  custom cache expiry for pages with `<categorytree>`.
- RSS extension:
  custom cache expiry for pages with `<rss>`.
- intersection extension:
  custom cache expiry for pages with `<DynamicPageList>`.
- Math extension:
  custom cache expiry if `<math>` failed.
- Wikibase extension, Flow extension:
  no caching for certain namespaces or content types.
- Graph extension, Kartographer extension:
  via onParserAfterParse hook, no caching if on preview.

Bug: T280605
Change-Id: Iea41ab8599ffae4622c97d682258b1b64eaf9ba2
2021-05-14 16:59:09 +00:00
libraryupgrader 12fb65b9f1 build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: I5c152292e83e7f3441e2c08b7d0ad23ac90f194b
2021-05-05 11:14:52 +00:00
Ed Sanders 911f1a68bd Apply transformations in ParserCache for all CommentFormatter features
i.e. for topic subscriptions as well as the reply tool.

Change-Id: I0a9e1a15e5a11adce0e1c55481fef0f4549360a6
2021-05-03 15:05:35 +01:00
Bartosz Dziewoński 49c1dde336 Abort DiscussionTools checks early when viewing a special page
Previously we relied on the NamespaceInfo check below to reject
special pages, but after commit 07d885248bc54bdc0f12d9745916c794d45ec81c
in MediaWiki core, PageProps throws an exception when called with a
special page.

Bug: T281180
Depends-On: I32c94107fde96b9d6344c77b621be9b3b9b7faaf
Change-Id: I0fd893c63a6e92f6c84e7aa92270852e1137fcad
2021-04-26 18:38:06 +00:00
Ed Sanders eae0c1e6e1 Implement hidden tag for source mode with toolbar
Bug: T279157
Change-Id: I0244530580c7243e4db33848d36c336d8e5e8a08
2021-04-22 17:44:00 +00:00
Ed Sanders 888d554ecf Don't split parser cache when reply tool is enabled by default
Bug: T279864
Change-Id: I16f1546e1373311563b8a90d6a025b0b45ffb793
2021-04-21 11:57:37 +00:00
Ed Sanders 722a4e5198 Avoid splitting ParserCache on user language
Bug: T280295
Change-Id: I87eab83803d24c11db4d723377bf7b40390b2e70
2021-04-21 11:57:30 +00:00
Bartosz Dziewoński 228b81fab9 Move implementation of subscribe buttons to CommentFormatter
Change-Id: Iad59ea047ed12bb34b483a94f443b39de6985bd3
2021-04-21 11:57:17 +00:00
Bartosz Dziewoński 1957c340b9 Remove unused variable
Change-Id: Ia4ad464b765c67aea27092a161d28ad1d890e96a
2021-04-21 11:57:11 +00:00
Bartosz Dziewoński 4bbfe6cb5d Rename CommentFormatter::addReplyLinks
Bug: T280351
Change-Id: I0d7627d63407e11cca6091f78e4d440eec6efa91
2021-04-21 11:24:03 +00:00
Timo Tijhof 269514f533 Hooks: Use WebRequest::getRawVal where possible
The 'dtenable' does not appear to take user-provided content that
requires language normalization. In general getRawVal should be used,
or if it's user input that needs normalization, use getText(). Perhaps
one day we'll alias or deprecate getVal (which is currently an odd
mid-way hybrid, most closely to getText; originally created for
EditPage.php textareas).

Change-Id: I8364c84f8c4f700da6e208df2e87c29bf254d685
2021-04-15 02:30:12 +00:00
Bartosz Dziewoński 9420f22e9d Don't allow query and cookie hacks to enable topic subscriptions
We can't allow it, because the required database tables may not exist
yet (T280082).

This is meant to be temporary until we complete DBA review and the
tables are created.

Bug: T280082
Change-Id: I8f947b779c6829763d3413931c6d354e6f7aee4d
2021-04-14 00:08:52 +02:00
Bartosz Dziewoński 3e319251f0 Fix check for your own talk page on subpages
Bug: T279604
Change-Id: I955a602ffb39f2443de9a3b165d8105ea3762058
2021-04-12 17:06:02 +02:00
Ed Sanders a555db7892 Topic subscriptions: Don't register notification type/group unless enabled
Bug: T279671
Change-Id: If3c46b992654c40daeeccaf8a3dcedde680c8404
2021-04-12 15:04:43 +00:00
Ed Sanders f6c9508001 Create constants for feature strings
Change-Id: I2d7bf18faf6345a4816c2ebef9744c4e6f62cc40
2021-04-12 14:40:51 +00:00
Ed Sanders 0a39c11914 Echo wiring for topic subscriptions
Depends-On: I60818d57552946857077dee93b0adb036621b791
Change-Id: I7e0996843cdd70141e19d5c7ce66122204efa1b7
2021-04-06 23:28:28 +02:00
Ed Sanders eb7e682d2f Topic subscription front end
Bug: T276996
Change-Id: Ifb62c04c2a0ea8399749b22021d6a1c5a079bf94
2021-04-06 23:28:28 +02:00
David Lynch 5b8646f73f Create table for topic subscriptions
Bug: T264885
Change-Id: I92d0362eac80ae1ae70839e26e2c084003862a5f
2021-04-06 21:24:53 +00:00
Ed Sanders 4c27187500 Make the source mode toolbar a user preference feature
Bug: T275950
Change-Id: I099af342f378215c68092d165dd88de1807d29d2
2021-03-31 22:40:53 +02:00
Ed Sanders ece8ff69ff Change dt- class prefix to ext-discussiontools-
Longer, but follows the style guide and less likely to conflict.

We need to account for init classes in the cache being around for
a while.

Change-Id: I738bc93393850db320fdbda2b003ca8ac40556da
2021-03-13 14:42:39 +00:00
Bartosz Dziewoński 68ad48f56f Allow users to continue using reply tool after disabling A/B test
Bug: T276967
Change-Id: I1fa120ded9ac3673fd3e5005618b3312ffd0aaf5
2021-03-09 22:20:03 +01:00
Ed Sanders 6224c11ff1 Always load init CSS when tools are available for a title
Also, make init CSS available on mobile.

Bug: T274311
Change-Id: I8f63fdb249cdd8ccdc6d1c4944d2622ac7d668cc
2021-03-06 12:08:50 +00:00