Commit graph

526 commits

Author SHA1 Message Date
Martin Urbanec 35320775e3 ApiVisualEditorEdit: Make tags param actually work
Why:
ApiVisualEditorEdit passes most of its params down to
action=edit. However, $params contains parsed version
of the params. Using it with tags results in the param
validator logic on ApiEdit's end receiving a PHP array,
which it does not expect (neither it should; it is impossible
to pass one via an actual API call).

This feature will be used in DiscussionTools,
which itself reuses ApiVisualEditorEdit.

What:
Use WebRequest::getText() to get the unparsed
value for 'tags', which makes the parameter
forwarding actually work.

Bug: T343339
Change-Id: I0ac60ca8473fe28461b2da60f9911baac4994388
2023-08-02 17:52:11 +02:00
Ed Sanders d4460219bd Add tag when reference added to the page
Bug: T325713
Change-Id: Ia4abe256c7ffffa749ad6cdb537dd26091ea07da
2023-07-03 15:09:12 +00:00
Ed Sanders d7d344035c Add tag when content added, according to EditCheck heuristic
Bug: T333714
Change-Id: Id806e6d4d856aead4af98d43078c534d4d46c7f0
2023-07-03 14:43:14 +01:00
Bartosz Dziewoński b986645d0a Fix trying to get a PageRecord for a non-existent page
This reverts a change from 5a792b6558. The hook only requires
a PageIdentity, and we only used toPageRecord() because it takes
a parameter to read latest data, and toPageIdentity() does not.
Instead call another method to update the internal data within the
Title instance. Maybe it's not great to rely on this side-effect…

Bug: T340568
Change-Id: If9cbd95eb84b6c39bf50af4564710839628a9bc3
2023-06-28 21:58:31 +02:00
jenkins-bot f22f0d4c68 Merge "React to hooks that are fired when inline switch is present" 2023-06-26 05:29:44 +00:00
hmonroy 4a028f1336 React to hooks that are fired when inline switch is present
React to hooks fired by core when the inline diff type switch is
present. VE needs to be able to disable the inline switch
when 'visual' mode is selected and enable the switch when 'wikitext'
mode is selected. When the 'wikitext' mode is selected and there is an
inline switch, the interface needs to show the diff type format previously
selected.

Toggle using new `mw-diff-element-hidden` class that is used by core so
that there's no clashes when hidding and showing the diffs.

Bug: T331589
Depends-On: Ie6a48e495f2bb299d8b984e7c40363d534c7915b
Change-Id: I4f790370dbfeb521f3b61c4d604245f77094abe9
2023-06-26 04:20:16 +00:00
Bartosz Dziewoński 5a792b6558 ApiVisualEditorEdit: Allow not returning the new revision content
Sometimes we call this API and then reload the page (or navigate to
another URL), without using the page content it returns. Save some
work and some data transfer and don't generate it in those cases.

Change-Id: Ic5fac61f3ef9b2dfce6ff757f1d414a9f41f217d
2023-06-22 21:08:15 +00:00
jenkins-bot ac4032eff5 Merge "Stop collecting stats per wiki" 2023-06-20 11:39:26 +00:00
daniel 4a2b3b580f Stop collecting stats per wiki
Having per-wiki statistics is neat but expensive. Now that VE has been
switched to not use RESTbase on all wikis, Go back to collecting
all stats under a single key. The relevant dashboards have already been
adjusted accordingly.

Change-Id: I9666bfa3fed547f3f619a9e0c9c24b9240edc359
2023-06-19 21:19:35 +00:00
Bartosz Dziewoński 8573df0233 ApiVisualEditorEdit: Remove unnecessary check
There are no occurrences of the error message in our error logging
data, so it most likely can never happen.

https://superset.wikimedia.org/superset/sqllab/
```
select count(*)
from editattemptstep
where event.save_failure_message = 'visualeditor-docserver'
```

Change-Id: I8172564057418283468c657cbc6d42ce8ddb35f4
2023-06-12 17:56:13 +00:00
jenkins-bot 9c4e8c4805 Merge "Always use the strict equality flag when using in_array" 2023-06-09 16:27:03 +00:00
jenkins-bot 550f73468e Merge "Bump requested Parsoid HTML version to 2.8.0" 2023-06-09 03:23:32 +00:00
jenkins-bot b9dc193037 Merge "Ensure a compatible Parsoid output version for direct client" 2023-06-09 03:22:18 +00:00
Ed Sanders f99c580aff Always use the strict equality flag when using in_array
Change-Id: Ic9d4d97cc95baf2b312a6a1d83b58ab410bcf504
2023-06-07 13:26:10 +01:00
jenkins-bot f1ce07c29d Merge "Move the diff-mode selector to the new TextSlotDiffRendererTablePrefix hook" 2023-06-06 18:26:57 +00:00
Arlo Breault 7d5b964507 Bump requested Parsoid HTML version to 2.8.0
This will ensure that media have the mw-file-element classes so that the
styling changes in I70c61493fe492445702f036e5b24ef87fc3bdf43 apply.

Older 2.7.0 content still in storage is missing the classes and doesn't
render correctly.

Note that I545ed75ed3c87e88b5e776696754e23c05645f81 made sure that
editing of both versions was always compatible.

Bug: T337596
Depends-On: Ia70f819df79fbb12a5b1dd6a98bfe0b968808d18
Change-Id: I40ed887e03f983e0737e1ee7cba5a4012fea31db
2023-05-31 12:12:59 -04:00
Arlo Breault e7e5241802 Ensure a compatible Parsoid output version for direct client
Presumably VE will move in lock step with the Parsoid library but this
retains the ability to negotiate even at this level.

Change-Id: Ice3beabcb1a475f2de9ad61e0f234a9cc23f80bd
2023-05-31 12:08:28 -04:00
Sam Wilson 137124a837 Move the diff-mode selector to the new TextSlotDiffRendererTablePrefix hook
Use the new hook to add the diff-mode selector to the area directly before
the diff table.

Also toggles the new inline-diff legend, when the initial diff-type is 'inline'.

Depends-On: I2a3c67bcfa47313dee597e602a62073e4e298cd2
Bug: T324759
Change-Id: I1584a84b3caea9eb142afba976c6ff47650c3832
2023-05-31 15:45:22 +10:00
Bartosz Dziewoński c37633bb83 Hide 'editnotice-notext' message in VE (and mobile apps)
Bug: T337633
Change-Id: I142edff12492e80b9c281353e6a53efc3339159c
2023-05-29 02:07:19 +00:00
Ed Sanders fe14ffb76b Output config var when VE disabled by hook
Currently we only disable the desktop init code when this hook
returns false, but other integrations may want to know about this,
e.g. MobileFrontend.

Bug: T174180
Change-Id: I0268239cc9ea2d397140e617fcb6e4e104a75f31
2023-05-26 18:42:19 +00:00
David Lynch 50c646050d Update VE core submodule to master (fd2f048e4)
Also supporting changes to support the new HelpCompletionAction,
including adding a preference to disable it if required.

New changes:
985b553cc Localisation updates from https://translatewiki.net.
aa26e27dc Localisation updates from https://translatewiki.net.
4cdc753ab Update OOUI to v0.47.0
bfc96a7ee Completions: always abandon if the first input is a space
616a6458f Fuzzy command bar
92b6525a2 Tweak the fuzzy command bar's behavior
fd2f048e4 Fuzzy bar: change how command groups are generated

Change-Id: Ic77b8822baecf5ad1ab466d94df29bb945172b55
2023-05-20 22:04:27 +03:00
jenkins-bot d6803f2533 Merge "Use edit intro messages and preloaded content from MediaWiki core" 2023-05-19 13:23:21 +00:00
jenkins-bot 1c5dbf6f79 Merge "Revert "onDifferenceEngineBeforeDiffTable: Return early on Special pages"" 2023-05-18 17:20:49 +00:00
HMonroy d88cd64e52 Revert "onDifferenceEngineBeforeDiffTable: Return early on Special pages"
This reverts commit f693822f64.

Reason for revert: Reworking

Depends-On: Idc96036564291a3887935dbff4ec476f4ad07068
Change-Id: Iee3f41c1b096b82ee61ecca9ddc5fcd044f1237c
2023-05-18 16:45:15 +00:00
HMonroy ba687994d3 Revert "onDifferenceEngineBeforeDiffTable: Update comment"
This reverts commit d7262d8483.

Reason for revert: Reworking

Change-Id: Idc96036564291a3887935dbff4ec476f4ad07068
2023-05-18 16:45:11 +00:00
Samtar 09bb8f9168
Revert "Move the diff-mode selector to the new DifferenceEngineBeforeDiffTable hook"
This reverts commit 7dbe385773.

Reason for revert: Reworking

Change-Id: I60784afa0d47e22acd9e8a981092784c84b250eb
2023-05-18 15:36:38 +01:00
TheresNoTime d7262d8483 onDifferenceEngineBeforeDiffTable: Update comment
Bug: T336582
Follows-up: I251db11e8cb5b785744ee2c111d20a346937b78c
Change-Id: Ic1a6a3d1fe50aab163ce0fb17ae7379bff172adb
2023-05-16 17:38:05 +00:00
TheresNoTime f693822f64
onDifferenceEngineBeforeDiffTable: Return early on Special pages
Add a check of `$diff->getTitle()->getNamespace()` to ensure early
return on NS_SPECIAL pages.

Bug: T336582
Change-Id: I251db11e8cb5b785744ee2c111d20a346937b78c
2023-05-16 12:39:19 +01:00
Bartosz Dziewoński a88084509d Use edit intro messages and preloaded content from MediaWiki core
Use MediaWiki core helpers to provide intro messages (including edit
notices), initial page content, and CSS classes for the edit area.

The following intro messages were previously unimplemented,
and will be shown now:
* 'sharedupload-desc-create'
* 'sharedupload-desc-edit'

The following intro messages were previously unimplemented,
but they only apply to pages where VE should never be available,
and will be shown now when editing those pages with 2017WTE:
* 'code-editing-intro'
* 'talkpagetext'

The following intro messages were previously unimplemented,
and are now explicitly skipped:
* 'editpage-head-copy-warn'

The following intro messages were previously unimplemented,
but they only apply to pages where neither VE nor 2017WTE should
ever be available:
* 'userinvalidconfigtitle'
* 'usercssyoucanpreview'
* 'userjsonyoucanpreview'
* 'userjsyoucanpreview'

Depends-On: If0b05710cb52a977bf4e85947d72d68683a0a29e
Bug: T201613
Change-Id: If26e39e383b983f7ee834ed6dd73b80e0545b068
2023-05-16 02:34:35 +02:00
Sam Wilson 00abad4861 Don't show the diff-mode selector if not viewing a diff
The DifferenceEngineBeforeDiffTable hook is run when viewing a
diff after switching from visual to source editing, but the
mode selection widget shouldn't be shown then.

Bug: T324759
Change-Id: Ieb8a1b77928201a45635af46635b902cac01a36d
2023-05-10 18:53:37 +00:00
Bartosz Dziewoński ec425a06af Fix one more place where we tried to set preferences for temp users
Follow-up to 3b1a2d9dce.

Bug: T332415
Bug: T332435
Change-Id: I1139f1f3421fe43dfd5e3125b18d40421930a0f1
2023-05-10 04:20:03 +02:00
gerritbot a6c5082fa3 Update moved class EditPage
See T321882. Moved in Ibefc44eb64aed

Bug: T321681
Change-Id: I5faaf6c59e96154eba0a4b199e47ecef49a89c72
2023-05-06 21:21:44 +00:00
jenkins-bot 3f43c00c2b Merge "Remove unused preferences code for "alpha" visual editor opt-in" 2023-05-05 16:39:13 +00:00
jenkins-bot 7c0259a3c3 Merge "Handle temporary users when dealing with user preferences" 2023-05-05 15:55:49 +00:00
Bartosz Dziewoński edec1ab393 Remove unused preferences code for "alpha" visual editor opt-in
Change-Id: I60601874f9442992c4f844304a842cf640f5b618
2023-05-05 16:22:46 +02:00
Bartosz Dziewoński 83d3d1f3ba Rephrase visual editor disable preference label
Visual editor is not in beta, and this preference is not temporary.

Change the message key to avoid outdated on-wiki overrides.

Unfortunately the internal preference name still has "betatempdisable"
in it. We should investigate renaming it later.

Bug: T197282
Change-Id: If1475a18474e85cd3a260224c738d087d472af70
2023-05-05 16:15:43 +02:00
Bartosz Dziewoński 37ab4c2a80 Expose automatic temporary user info in the API
Depends-On: I62b4bb630decac92cbb8c7ddf00307df0dadb516
Bug: T332435
Change-Id: I84ce108b4d46b4e19fad032382f8b69a1b0065d5
2023-05-04 00:44:10 +02:00
jenkins-bot c2f79c7836 Merge "ApiVisualEditor: Support preloading from i18n messages" 2023-05-02 22:37:36 +00:00
Martin Urbanec c4839e21fb ApiVisualEditor: Support preloading from i18n messages
The `preload` parameter currently does not work with i18n
messages, as pages representing those messages are known, but
do not exist. Resolve this by running any NS_MEDIAWIKI page
through wfMessage() first.

This feature will be used by Personalized praise in GrowthExperiments,
which requires the preload from i18n messages capability. As a benefit,
it also makes it easier to create i18n'ed preload-based systems
(one can create MediaWiki:Foo, MediaWiki:Foo/cs and MediaWiki:Foo/de);
MediaWiki will select the best language version automatically.

MediaWiki core equivalent is uploaded as
I693bcaf71d7b8557c63538a426d7a6bd4c3edf3d.

Bug: T330337
Change-Id: I961ff7ae2263e61161e686107d80bdafa3fe3c32
2023-05-02 20:06:15 +02:00
jenkins-bot 0a28512624 Merge "Don't force the "view" flavor when using stashing!" 2023-05-01 13:46:25 +00:00
jenkins-bot 86568aff16 Merge "Move the diff-mode selector to the new DifferenceEngineBeforeDiffTable hook" 2023-04-28 17:23:09 +00:00
Bartosz Dziewoński 3b1a2d9dce Handle temporary users when dealing with user preferences
As temporary users will not have access to user preferences (T330815),
use cookies or localStorage to save them, like we already do for
logged-out users.

Also add some comments to point out where we intentionally distinguish
logged-out and temp users.

Bug: T332435
Change-Id: Ic83dd8bc8bc107f603a9b0340bd9e2bcaad8ff5a
2023-04-28 15:57:46 +02:00
Ed Sanders 51759c3f7e Remove DiffPageEnable config option
Visual diffs are always enabled on history pages, there is no
long a need for this to be configurable.

Change-Id: I9cef558b2b9d32bc86c47f6a6095270220d036db
2023-04-26 17:05:57 +01:00
gerritbot 5b8c2a3afa Update moved class WikiMap
See T321882. Moved in I60cf4b9ef02b9d5

Bug: T321681
Change-Id: If4a7ece606985b0e702288d1f3a08a270adcc760
2023-04-25 09:55:53 +00:00
Bartosz Dziewoński d7521704a1 Remove some redundant PHPDoc comments
More could be done, but these are the ones that annoy me the most,
and I'm not willing to do more changes right now.

Change-Id: Ia02af09d631fea191e57da75420f0d2d1ed46c19
2023-04-24 21:11:26 +02:00
jenkins-bot 5c89247be9 Merge "Use new showPendingTakeover OutputPage method" 2023-04-21 13:11:54 +00:00
Sam Wilson 7dbe385773 Move the diff-mode selector to the new DifferenceEngineBeforeDiffTable hook
Use the new hook to add the diff-mode selector to the area directly before
the diff table.

Also toggles the new inline-diff legend, when the initial diff-type is 'inline'.

Depends-On: I6de30bf79eb5ac262285951792782b870d075e00
Bug: T324759
Change-Id: Ifc133856dd793693c3a2722a7b1319dfe74555a2
2023-04-21 16:03:16 +08:00
jenkins-bot 9cb6f54d3b Merge "Remove the BetaFeatures integration for historical visual diffs" 2023-04-20 09:44:13 +00:00
James D. Forrester bc7db78906 ApiVisualEditor: Support Special:MyLanguage for editIntro param too
Bug: T334855
Follows-Up: I43f461e9f595c364ecdaf2faccbd580fc0df6799
Change-Id: I106941f827d1dd246733d72989bbe9504c221c6f
2023-04-19 19:20:27 +00:00
Bartosz Dziewoński adc0bcdfcd Remove the BetaFeatures integration for historical visual diffs
Bug: T333448
Change-Id: If4f732851a42802b612cef618196c9854e2cf9da
2023-04-18 22:34:05 +02:00