Commit graph

231 commits

Author SHA1 Message Date
jenkins-bot cf8913d6a0 Merge "Don't use globals to access config" 2020-02-21 21:16:04 +00:00
Bartosz Dziewoński da11a3be73 When launched from an old revision, reply to latest revision
The "Reply" buttons were active when viewing an old revision of the
page (&oldid=1234). This was probably unintentional, and it would undo
all more recent comments if you saved yours.

However, I think it would be a useful feature. You often end up
viewing old revisions when reviewing changes to pages from your
watchlist or email notifications.

Now, when the reply widget is launched from an old revision, it will
try to find the relevant parent comment in the latest revision of the
page, and edit that revision when inserting the reply. If the parent
comment is gone, it shows a useful error message.

Bug: T235761
Change-Id: I8c5b631d3bfb62196fd219cbcd7d497408d187a7
2020-02-21 17:09:47 +00:00
Ed Sanders 2577d5aa28 Add beta feature preference
Bug: T245539
Change-Id: I8bb2c10255a13c291bc97c591612cadaf0e4339f
2020-02-21 15:20:48 +00:00
Ed Sanders f75137ecc1 Don't use globals to access config
Change-Id: I6180dff629af554b5430e20c2db2f6f94ef96478
2020-02-21 15:20:47 +00:00
Translation updater bot 6bf864d50f Localisation updates from https://translatewiki.net.
Change-Id: Ia412e68ec64a56da7ce70f1b0107bc846ec7c016
2020-02-21 09:38:37 +01:00
Bartosz Dziewoński ff0386239f Only detect comments with real signatures
Consequences of this are visible in the test cases:

* (en) Tech News posts are not detected.
  Examples: "21:22, 1 July 2019 (UTC)", "21:42, 29 July 2019 (UTC)"

* (en) Comments by users who customize the timestamp are not detected.
  Examples: "10:49, 28 June 2019 (UTC)", "21:34, 14 July 2019 (UTC)"

* (en) Comments with signatures missing a username are not detected.
  This sometimes happens if a comment is accidentally signed with
  '~~~~~' (five tildes), which only inserts the timestamp.
  Examples: "17:17, 27 July 2019 (UTC)", "10:25, 29 July 2019 (UTC)"

* (pl) A lone timestamp at the beginning of a thread is not detected.
  It's not part of a post, it was added to aid automatic archiving.
  Example: "21:03, 18 paź 2018 (CET)"

Bug: T245692
Change-Id: I0767bb239a1800f2e538917b5995fc4f0fa4d043
2020-02-21 01:30:54 +01:00
Bartosz Dziewoński 7761f62b42 Fix edit summary for comments in 0th section (no heading)
Bug: T245765
Change-Id: I9eb4726ef096b8d7459cc1409814514ec1dc89ae
2020-02-21 00:44:42 +01:00
jenkins-bot 4ee1ac11f0 Merge "Defensive use of dynamic paths in maintenance script" 2020-02-20 19:23:35 +00:00
David Lynch d543e7a4f9 Defensive use of dynamic paths in maintenance script
Bug: T242134
Change-Id: I64fc136d3d19268008062dc8a2c655c8551244ea
2020-02-20 19:51:07 +01:00
Translation updater bot 080ca1f571 Localisation updates from https://translatewiki.net.
Change-Id: Icffe9625fa83aa955f8f9c24089eb3a6d69b2c55
2020-02-20 09:26:51 +01:00
DannyS712 6bef74693f Stop using old deprecated SpecialPageFactory static functions
Bug: T245686
Change-Id: I7501a66b0649bb3d2a928999f63a08371e1856ff
2020-02-19 23:15:32 +00:00
jenkins-bot d8b0cf747f Merge "Blacklist/convert tables and headings in VE target" 2020-02-19 21:07:44 +00:00
jenkins-bot 8043769e5c Merge "Remove vertical padding from VE visual target" 2020-02-19 21:07:43 +00:00
jenkins-bot 8dfe27aa89 Merge "Sig preview: Increase opacity" 2020-02-19 20:56:23 +00:00
Translation updater bot 16c85afe50 Localisation updates from https://translatewiki.net.
Change-Id: Ife75353660493ae1703730723c201cadcd00f716
2020-02-19 08:23:44 +01:00
David Lynch 017245cb50 Bump outdated packages: grunt-stylelint and stylelint-config-wikimedia
Bug: T242134
Change-Id: I8d62429529ab41039b3d738c1533e78324d197be
2020-02-18 19:27:54 -06:00
Ed Sanders 5f966e845b Remove vertical padding from VE visual target
Compensates for vertical padding on paragraphs.

Match source mode padding to that of a TextInputWidget.

Change-Id: Ia53d8d2a6b9eff464c6c61152d02250088049bf9
2020-02-18 15:53:45 +00:00
Ed Sanders 97cf4e8440 Blacklist/convert tables and headings in VE target
Change-Id: I5e58fb1da1cb793bad5fb9640ef2dbf14c96d082
2020-02-18 15:44:40 +00:00
Ed Sanders 1a93e420b3 Sig preview: Increase opacity
Closer matches disabled-grey which is more accessible.

Change-Id: Ieb98e88bb42fdec1f1089919cf2c0c5f72b21877
2020-02-18 15:43:06 +00:00
Translation updater bot 219da72031 Localisation updates from https://translatewiki.net.
Change-Id: Ied7ec18808ee655163d66c8411e26f33778a78e4
2020-02-18 08:25:04 +01:00
Translation updater bot b3c04bcc15 Localisation updates from https://translatewiki.net.
Change-Id: I66483327ab836ff31ed50f31379fcfe413ea69c5
2020-02-17 08:46:09 +01:00
Bartosz Dziewoński 7ea6cdf326 Try to resolve edit conflicts
The most common case of edit conflicts on talk pages is several people
responding to the same comment at the same time.[citation needed]

We can easily resolve this case by fetching the latest revision of the
page and re-running our code to insert a reply on it.

When we can't insert a reply, that probably means the parent comment
was deleted or moved, so display an error message indicating that
instead of the generic one.

Bug: T240643
Change-Id: Ic686acc747580d46779960211a02e9830a6ae86f
2020-02-15 05:43:14 +01:00
Bartosz Dziewoński 6f404e5ce2 Rebuild Parsoid document before attempting to save
Previously, we only built the Parsoid document once (on page load) and
kept it around forever. Every time we tried to post a reply, it was
added to this document, even if it wasn't saved due to some error.
This resulted in duplicate replies when the user managed to actually
save.

Now we only keep around the HTML string and some metadata fetched from
the API, and rebuild the actual document every time before adding a
reply.

Bug: T245333
Change-Id: Ib1c344a7d613cdf67644aa243147c5e699c2c1e7
2020-02-15 05:09:34 +01:00
Bartosz Dziewoński 80cddf549c Use built-in mw.Api 'badtoken' handling, also 'assert'/'assertuser'
This ensures that expired tokens are refreshed and retried, while
invalid tokens caused by the user logging in/out cause an error. We
should think about displaying a better interface for the latter case.

Bug: T245327
Depends-On: I485f99e1f5f493262b0c9af22370da01adf1e09c
Change-Id: Ibc097ed68e3ae72223b0680ee8895f7884399958
2020-02-15 03:07:02 +01:00
Translation updater bot 390ab1972f Localisation updates from https://translatewiki.net.
Change-Id: I51441f5b823476f98e43995da73b5849d36de4dc
2020-02-14 08:25:36 +01:00
Translation updater bot e03345caa2 Localisation updates from https://translatewiki.net.
Change-Id: I95d74da7e75b964fced26f94a92309199700a39f
2020-02-13 08:54:42 +01:00
jenkins-bot f0fe7e68c2 Merge "Improve comment ruler drawing in debug mode when indentation is weird" 2020-02-12 23:57:24 +00:00
jenkins-bot 7d86d1b24a Merge "Rename the lines denoting child comments in debug mode to "rulers"" 2020-02-12 23:57:24 +00:00
Translation updater bot 74bab12a86 Localisation updates from https://translatewiki.net.
Change-Id: I26b87e073f138a80ecfe72e8e1bb8e0258ab5efd
2020-02-12 08:21:33 +01:00
Translation updater bot c32c84f241 Localisation updates from https://translatewiki.net.
Change-Id: I0219d242bfe6b0ec4f8536af241bee5483be34c0
2020-02-11 08:19:12 +01:00
Bartosz Dziewoński 3896babde3 Improve comment ruler drawing in debug mode when indentation is weird
Ignore the horizontal position of the comments' bounding boxes entirely.
It can be crazy because of de-indentation in the middle of the comment,
and even just text formatting with padding/margins (e.g. `<code>`) can
make it look weird. Just draw the rulers based on detected indentation.

Change-Id: Id4e5edf076d44bdedfb45958260d797daea29ed1
2020-02-11 02:32:32 +01:00
Bartosz Dziewoński a491e3aaac Rename the lines denoting child comments in debug mode to "rulers"
I got tired of typing "relationship".

Change-Id: I318bdd1c049d7ab7fdeb1512a083cf8f4121d598
2020-02-10 22:14:38 +01:00
Translation updater bot 76ff5d1114 Localisation updates from https://translatewiki.net.
Change-Id: Ia5da4fe99eb1b5f14d85ebab6dec00fe294d1e71
2020-02-10 08:33:30 +01:00
Ed Sanders c8564f6ccb Re-style preview
Bug: T238177
Change-Id: Iabc7cfa7595d60cbd0482340bd159002ee5a6b0e
2020-02-08 00:13:41 +00:00
jenkins-bot b80f7ee82e Merge "Change tags method so anon edits will get tagged" 2020-02-07 09:09:38 +00:00
Translation updater bot cbd6aad04f Localisation updates from https://translatewiki.net.
Change-Id: I317d5ace634002cd726550194363ccac34737254
2020-02-07 09:57:17 +01:00
David Lynch 16215bbea2 Change tags method so anon edits will get tagged
Bug: T242184
Change-Id: I38baddc0febe02f6d2321be616adc018c87b5a54
2020-02-07 01:19:11 -06:00
David Lynch 2fcc23ae61 Add editor-mode changetags
Bug: T242184
Change-Id: Ib307e44ec883b01e0705c889f97e16326519f4c2
2020-02-06 20:22:27 +01:00
Translation updater bot 0f67d1862e Localisation updates from https://translatewiki.net.
Change-Id: I98b7c1057bf956a55cc1faba0d964e0aec28af14
2020-02-06 08:19:13 +01:00
Bartosz Dziewoński e5e6fdd3af Stop using native Range objects, they're too annoying
Native Range objects are automatically updated when the DOM elements
they refer to are affected (e.g. detached from the DOM, or their offset
changes because of siblings being added/removed).

This seemed harmless or maybe even slightly useful, but it turns out
it conflicts with VisualEditor, which has to wrap the entire page in a
new DOM node when it opens (and unwrap it when it closes), effectively
temporarily detaching it from the DOM, which destroys all our ranges.

Just use a plain object that stores the same data as a Range. And when
we need to use Range's API, we can simply construct a temporary one.

Bug: T241861
Change-Id: Iee64aa3d667877265ef8a59293c202e6478d7fb6
2020-02-05 19:42:03 +01:00
Translation updater bot b84bfec3d4 Localisation updates from https://translatewiki.net.
Change-Id: Id0ea210f9d755a0203e939c603d0b035e52b2c7f
2020-02-05 08:18:49 +01:00
Bartosz Dziewoński 44eb801844 Add config option and query parameter to control loading
By default, DiscussionTools loads on all talk pages when the extension
is installed. This can now be disabled by setting the configuration
option `$wgDiscussionToolsEnable=false`.

To test DiscussionTools, one can now use the query parameter
`?dtenable=1`, which allows it to be loaded on any wikitext page
(overriding the config option).

Bug: T243621
Change-Id: I3d5a9cc9a4183fb6951f05c557b1d42735a9df7c
2020-02-04 22:06:13 +01:00
David Lynch 664b2890d7 Tag DiscussionTools edits
This sets up the tags:
* discussiontools
* discussiontools-reply
* discussiontools-edit (not yet implemented)
* discussiontools-newsection (not yet implemented)

The tags are flagged as user-addable, because otherwise they can't be
passed through to the VE API (at least, not without editing it so that
it explicitly knows about them, which seems like a strange
interdependency). It's assumed that letting users who know about the
tags add them to random changes via action=editchangetags would be
(a) the pettiest and most inconsequential vandalism possible, and
(b) unlikely to happen.

This relies upon I2c1d0f8d69bc03e5c1877c790247e165f160e966 in
VisualEditor to not also tag the edits with `visualeditor`.

Bug: T242184
Change-Id: I4e5e26afdd52279df242e1912f073b415b812c3b
2020-02-04 11:15:18 -06:00
Translation updater bot e9e1e8d112 Localisation updates from https://translatewiki.net.
Change-Id: I56af1277158328b998f6c44d4e277dbf47a61008
2020-02-03 08:26:39 +01:00
jenkins-bot 601226199d Merge "Handle comments before first section heading" 2020-01-30 23:19:29 +00:00
Bartosz Dziewoński e29b8173bf Handle comments before first section heading
The loop in parser.js assumed that there was always a heading before
any comments (not counting the page title, only section headings).

Bug: T243869
Change-Id: I3a0bb06716e75d4a17e25c40748673a071ee5f30
2020-01-30 00:14:46 -08:00
jenkins-bot f735e47fdd Merge "Attach highlights to positioned container" 2020-01-30 00:07:04 +00:00
jenkins-bot 3b4ae40658 Merge "Don't use RangeFix for node rects" 2020-01-30 00:02:49 +00:00
Ed Sanders 4b3d92a5e9 Attach highlights to positioned container
Bug: T240639
Change-Id: I41a547acd3e5d7e9a49f99fc5ef35738d038007e
2020-01-29 15:22:20 -08:00
Ed Sanders 087d1eb428 Don't use RangeFix for node rects
Change-Id: I60e45ee9288fbdad26bb85997a7b4a24234fa8b4
2020-01-29 15:22:19 -08:00