Commit graph

321 commits

Author SHA1 Message Date
Svantje Lilienthal 2665734b10 Renaming temporary config variable and splitting it from cirrus search lookup
This allows using the config variable independendly from the cirrus search extension.
This way it can be used for all subtickets of T271802.

Bug: T277028
Change-Id: I1b3bdda5fa6fbfe5c531c3b51c2c8e2a28ed1faf
2021-05-10 14:47:31 +02:00
jenkins-bot 5d1e79630f Merge "Introduce VisualEditorApiVisualEditorPostSaveHook" 2021-05-06 17:57:38 +00:00
jenkins-bot a4d1863a80 Merge "Use standard search API when searching for templates" 2021-05-03 08:12:35 +00:00
Kosta Harlan f035ce51f1 Introduce VisualEditorApiVisualEditorPostSaveHook
What:

Add hook that runs after a save attempt is made in ApiVisualEditorEdit.
The hook receives the same data available in ApiVisualEditorEdit, and
implementations of the hook can modify the API response.

Also introduce templated
parameters (https://www.mediawiki.org/wiki/API:Templated_parameters) in
the API parameters; this allows plugins to pass arbitrary data along
with their request using e.g. plugins=linkrecommendation&data-linkrecommendation=foo

Add ServiceWiring files, a PHP namespace, and a HookRunner class to
support the above changes.

Why:

VE plugins may wish to send additional data when saving an edit and take
action based on that data on the server-side. See for example the
AddLink plugin in I7a052f8e which sends annotation data, and then uses
the new hook to perform a database operation.

Change-Id: I392691475fbdcec766acbd832600e82efcb5bfe8
2021-04-30 20:50:01 +02:00
jenkins-bot 6e6adb5508 Merge "Replace usage of deprecated User watchlist methods" 2021-04-30 18:41:16 +00:00
Thiemo Kreuz 6e08a27fc7 Use standard search API when searching for templates
Bug: T274903
Change-Id: I7de8f6cc55ab678ed741ae5ebbaad608b9a9b0db
2021-04-30 12:52:45 +00:00
libraryupgrader 710e75dfb0 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: Iae29334b618b3f3758cb048394f85c0aca81b42c
2021-04-29 19:18:20 +00:00
Cindy Cicalese 442f5da371 Replace usage of deprecated User watchlist methods
This bumps the MediaWiki requirement to 1.37.

Bug: T281187
Change-Id: Iddcd1cbf67ad1f8e918c1da07347dd19e5f6f7d9
2021-04-29 09:32:22 -07:00
DannyS712 67a03105e0 ApiVisualEditor: remove call to deprecated User::isIP
Bug: T281401
Change-Id: I913e1ecaeadb2b36227b2dd205869db5f9a07691
2021-04-28 18:50:18 +00:00
Andrew Kostka 3c2db5fba9 Relocate parameter descriptions in the transclusion dialog
Bug: T273425
Change-Id: I2044b65ba88ae00e394fb84cb8e96a218995918a
2021-04-15 13:08:53 +02:00
Bartosz Dziewoński c832df5d3a api: Better error when a page with the given title can't exist
Bug: T279711
Change-Id: Icd7e7564bbbca47ea53dfe72c5f34ffa69ff3389
2021-04-14 16:11:18 +02:00
Bartosz Dziewoński aec35a67d0 api: Better error when 'wikitext' parameter is required
Bug: T280072
Change-Id: Ibd03aa2a527ac2d27ef7c3dbaf25df74a2a0fdc5
2021-04-14 16:10:26 +02:00
jenkins-bot 1e4de0e464 Merge "Add a combo box for suggested values in the transclusion dialog" 2021-04-09 10:40:33 +00:00
Bartosz Dziewoński 1b34b59aa7 SECURITY: Act like users don't exist if hidden from viewer (VE edit notices)
Applying the changes from the MediaWiki core patch for T120883
(Ife272a0eb1f3322bc8eb30ca803bd21801acba3e) to our duplicated
code implementing the same functionality.

Bug: T270453
Change-Id: I1b2de322aa0c69eb6d3b3ffadaed3fbaa3a58bca
2021-04-08 20:40:08 +01:00
Andrew Kostka de2f5b3055 Add a combo box for suggested values in the transclusion dialog
Bug: T271898
Change-Id: Ic637eea2cac45f79234b62c787e1b76d68b61570
2021-04-08 16:10:22 +02:00
Umherirrender ac5bd772a9 build: Remove unneeded @codingStandardsIgnore
line length was increased to 120 in 31.0.0

Bug: T278594
Change-Id: Ie5b28a7bfd5c9f795978d0773b02e080d9fe44a7
2021-04-03 21:41:58 +00:00
ZabeMath 3bd0f02ac2 Avoid using User::setOption()
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()

Bug: T277818
Change-Id: I7395a8620064dcbe019b92feba17d9c9996ffbb7
2021-03-30 21:47:04 +00:00
Daimona Eaytoy 8f65b0c2e2 Stop using deprecated methods in Language
Change-Id: Id3b7cb3bc79e6d8189d45e638d928508308bb3e8
2021-02-27 13:51:49 +00:00
jenkins-bot 18f5e7e2f0 Merge "Fix $wgVisualEditorUseSingleEditTab compat with PostgreSQL" 2021-02-25 20:41:39 +00:00
vladshapik 3d29dd25e9 Avoid using User::IsIP
Remove using of User::isIP since this method will be hard-deprecated. Now it is soft-deprecated

Bug: T275602
Change-Id: Ia625be523706d1e24649f7aa15679491f9598b7f
2021-02-24 17:38:04 +02:00
Bartosz Dziewoński 932d009cd7 Fix $wgVisualEditorUseSingleEditTab compat with PostgreSQL
Bug: T270953
Change-Id: I30bd329e8c19d7b2e7ae905cead6b21b8584db5d
2021-02-24 00:31:44 +01:00
Bartosz Dziewoński e061cd5c3a VisualEditorDataModule: Use ResourceLoaderContext::encodeJson
Follow-up to Iab139c4dd69c9a16c9f4f9e2fd47ec76a9003152.

Change-Id: Ia16dad8b6c450f4cb095a67af1c1c2b487e8536b
2021-02-18 21:53:24 +01:00
Bartosz Dziewoński 2c5197f1b9 Fix Phan failure
The failure was:
includes/VisualEditorDataModule.php:37 PhanTypeMismatchArgument Argument 2 ($pretty) is ResourceLoader::inDebugMode() of type int but \FormatJson::encode() takes bool|false|string defined at ../../includes/json/FormatJson.php:115
includes/VisualEditorDataModule.php:41 PhanTypeMismatchArgument Argument 2 ($pretty) is ResourceLoader::inDebugMode() of type int but \FormatJson::encode() takes bool|false|string defined at ../../includes/json/FormatJson.php:115

Probably triggered by changes to MediaWiki in commit
Ieaf04e0c289646dd5d5b027b4f1f8278167b2d57.

Change-Id: Iab139c4dd69c9a16c9f4f9e2fd47ec76a9003152
2021-02-17 22:27:22 +01:00
Bartosz Dziewoński 263a4d1af7 Only show "Editing mode" preference when VE enabled (on SET beta-feature wikis)
Also, show the editing tabs dialog when appropriate.

Bug: T273189
Change-Id: I1293e0d69580372b23142493ee8905c18df40d23
2021-02-05 12:41:10 +00:00
Bartosz Dziewoński ef8e7945cc Stop showing the "Editing tabs" popup some time after SET switch
If someone has edited before the switch (2016-ish), never edited since
then, and try to edit again now, it's probably no longer helpful to
show them a popup dialog about a change that happened 5 years ago.

The immediate motivation for this, though, is T273189. We discovered a
bug with the preferences that, among other issues, caused this dialog
to not be shown in some cases where it should have been, and fixing
the bug now would cause it to be shown the on the next edit attempt.
If someone has edited before the switch (2016-ish), *and* edited since
then, and try to edit again now, it's definitely not helpful at all to
show them a popup dialog about a change that happened 5 years ago.

Bug: T273189
Change-Id: I4b5a3d8dbdf1c853eb39fcfc85a9fe87a4db0f21
2021-02-05 12:41:01 +00:00
Bartosz Dziewoński b91c8647fe Ignore user prefs for enabling/disabling VE which are not settable
We have two preferences used for enabling/disabling VE:
'visualeditor-enable' and 'visualeditor-betatempdisable'.
(And 'visualeditor-autodisable', which sometimes overrides
them both, but it's not relevant here.)

The user can only set 'visualeditor-enable' when VE is Beta Feature,
and they can only set 'visualeditor-betatempdisable' when it is not.

However, when deciding if VE should be loaded, we always checked both
of the preferences. This gives incorrect results when the preference
that is not supposed to be settable actually exists, due to being set
in GlobalPreferences on another wiki where it's settable.

A similar issue could occur if VE configuration is changed from Beta
Feature to a normal preference (or the other way around), and the
preference values for the previous configuration still persist.

Bug: T271434
Change-Id: I7399b3c516f762429050a662ac85d1d392392323
2021-02-05 12:40:51 +00:00
Bartosz Dziewoński 4b1f141511 Do not define contradictory user preferences for enabling/disabling VE
Depending on the config, we would sometimes define both the
'visualeditor-enable' and the 'visualeditor-betatempdisable'
preferences, even though they contradict each other.

Bug: T273188
Change-Id: I6ac7e4580bf232a5198ad8842f814bc381131e00
2021-02-05 12:40:38 +00:00
Bartosz Dziewoński b1fa5839c4 Remove two unused configuration options
* VisualEditorNewAccountEnableProportion
* VisualEditorAutoAccountEnable

Seemingly never used on Wikimedia wikis, and untested since 2016.

Bug: T273177
Change-Id: Ic132ef2091399fd223626ae307830f278e72ec01
2021-02-05 12:40:28 +00:00
C. Scott Ananian fce9192e82 Rename magic header to be consistent with WMF CDN infrastructure
This name is consistent with T91820.

Bug: T91820
Bug: T259685
Depends-On: I0c4ec63bb26641b237c92dbd3bc5367811ca0675
Followup-to: 3561167493
Change-Id: I4c4c5f83ad56a198d08095d629a6ba86ce9dc1a4
2021-02-04 12:54:21 -05:00
C. Scott Ananian 3561167493 Fix sqlite compatibility by opting out of obligatory write lock
Bug: T259685
Depends-On: If37dc890a24a45c3a914e310b5b5bf625965e9e6
Change-Id: Ib203145f4c9ddfdc6701a916cbbbe17dae85efb9
2021-02-02 18:05:21 -05:00
Ed Sanders 5e1b299c0b ApiVisualEditor: Return notices as an associative array
A couple of things make this quite a simple change:
* Most messages are generated from a single message key
* $title->getEditNotices() already returns an array
  keyed in the same way, we just currently flatten it.
* The VE client already flattens the array immediately
  in ArticleTarget#parseMetadata, so no change required.
* PHP preserves the order in which keys are added, not
  that notice order is particularly important.

This partially undoes c824dc383a,
which changed the format from a mixed array to an indexed array.

Bug: T272188
Change-Id: I646667fe2513e371e0c8270761553253d1abe2b6
2021-01-18 23:35:56 +00:00
Thiemo Kreuz f1dcc5d3c8 Prefer UserIdentity::isRegistered over isAnon
isRegistered is part of the slick UserIdentity interface, i.e.
it's the more "canonical" form. This change makes it a bit
easier to move away from using the huge (4000+ LOC) User class
everywhere, in favor of the UserIdentity interface, where
possible.

This patch is meant as a small step towards this goal. I tried
to replace some usages of User type hints already, but prefer
to go in small, incremental steps.

Change-Id: I827b83a5304b1975437d5fd5083f2877dba6f6d8
2021-01-07 17:01:22 +01:00
jenkins-bot 349a6e8568 Merge "ApiVisualEditor: Support 'preload' etc. for new sections in visual mode" 2021-01-05 14:23:26 +00:00
jenkins-bot aa58894051 Merge "ApiVisualEditorEdit: the 'html' parameter should be raw to avoid normalization" 2021-01-01 00:33:19 +00:00
C. Scott Ananian aceea5b623 ApiVisualEditorEdit: the 'html' parameter should be raw to avoid normalization
Although wikitext is (expected to be) in Unicode Normalization Form C,
the output HTML may not be, due to the presence of explicit entities in
the wikitext representing non-NFC codepoints.

Bug: T266140
Depends-On: I2e78e660ba1867744e34eda7d00ea527ec016b71
Change-Id: I0d34c9a01f1132c2616ed3392ea40d8b73e15325
2020-12-21 20:55:37 -05:00
James D. Forrester 75f38008d9 Use User->isRegistered(), not deprecated isLoggedIn()
Bug: T270450
Change-Id: I5ed35fb2480a452219ac766e457333da955a10fe
2020-12-17 18:40:30 -08:00
Bartosz Dziewoński 4ca05702cd ApiVisualEditor: Support 'preload' etc. for new sections in visual mode
Bug: T269310
Change-Id: I66ed8449cae8e548c5b30f434cc8430fed128f14
2020-12-17 02:00:44 +01:00
jenkins-bot 2cc0cbc0ff Merge "Fix handling of EditFormPreloadText" 2020-11-02 22:35:07 +00:00
Ostrzyciel 4614b3db11 Fix handling of EditFormPreloadText
The hook should work now.
I tested it manually and preloading with extensions works fine.
Preloading the default text for system messages is fixed as well.

Bug: T266404
Change-Id: Icf40112bd5fabf24452f9b807b388399c7c920f0
2020-10-30 20:28:43 +00:00
Bartosz Dziewoński 9f9966d1cd ApiVisualEditorEdit: Use action=parse 'subtitle' option
Bug: T259313
Depends-On: Id1fa03d05e6a984862861a1de37d84e48a692d79
Change-Id: I15df60de7c2376d04e07c27a8c1f4d057af53b20
2020-10-29 18:49:51 +00:00
Ed Sanders 3e34dbdcd0 No longer run OutputPageBeforeHTML hook now it happens in core
This partially reverts I015ac183a0c25dafb9b95c577edd4ef59c112d43.

Bug: T266195
Depends-On: I5b41251ad95ea58153fb7e32dba62d407f0844ac
Change-Id: I1d408f53c86f1d8809ee9c8a3ec48992ecd03cee
2020-10-22 14:08:06 +01:00
jenkins-bot a5cc81a630 Merge "Fix editnotice order in VisualEditor" 2020-10-19 20:15:21 +00:00
Ed Sanders 98a1c203c1 Filter empty edit notices
Bug: T265798
Change-Id: I10bc181b66288f89775566e1b06ae1e508484724
2020-10-17 16:31:27 +01:00
proc c824dc383a Fix editnotice order in VisualEditor
Bug: T263255
Change-Id: I83e6910c4886cc5a0170dc05e60459f3427aebe5
2020-10-16 01:14:21 +01:00
Thiemo Kreuz e13781ce1f Remove non-helpful lines of documentation
These do nothing but repeating literally what the code already
says.

Change-Id: I93c4a60f190e17a845e37e48b1c0a80bde2292c0
2020-10-07 15:24:50 +02:00
Thiemo Kreuz 1230e25cbf Add missing constant visibility keywords
Not used outside of this class. Confirmed via CodeSearch.

Change-Id: I8ffed9ed88bc60e7529d277df5b474d85437ed6e
2020-09-09 16:59:39 +02:00
jenkins-bot 35d846f7af Merge "Better warning messages if $oldid or $etag is funny" 2020-09-01 21:11:52 +00:00
jenkins-bot a7832b6bf5 Merge "Start using edit api results for watchlist UI updates" 2020-08-26 23:32:44 +00:00
Dayllan Maza 4fc73112ee Start using edit api results for watchlist UI updates
This patch starts using watchlist related values from ApiEditPage
results instead of updating the "watch link" based on whether the
checkbox was selected or not at the time of saving the article.

This change does not depend on T261030 and can be merged without it
but T261030 needs to be fixed or temporarily watched items will not
display the right tooltip when hovering the "watch link" or star icon.

Bug: T260434
Change-Id: I2c844223620d7d28f36a0cd8ae3dee4b0c8ae5bf
2020-08-26 23:08:47 +00:00
C. Scott Ananian bf79850262 Better warning messages if $oldid or $etag is funny
Change-Id: I65f02ded600662fd19de36ef3a9ae55ecf249226
2020-08-26 18:56:22 -04:00