Commit graph

846 commits

Author SHA1 Message Date
Ed Sanders 7cad692afa Move ApiDiscussionTools to ApiDiscussionToolsPageInfo
Also remove 'paction' param, and instead make 'transcludedFrom' a
property of the result object.

Change-Id: I0a289f6d71e4708afff0b52066b1ed6faf76b9ae
2022-02-07 16:50:02 +00:00
Ed Sanders 0b42aea276 CommentParser: Cache variables in getUsernameFromLink
Change-Id: I625e6ded3badd75a7a658c8d000576d0d165a18b
2022-02-04 19:35:18 +00:00
Ed Sanders 8ad1df7dc8 CommentParser: Name parts of return value from findSignature
Change-Id: I3a5ad36df0afdedc0aa9a15e5d83c5426b03b790
2022-02-04 19:34:18 +00:00
jenkins-bot b0b965512e Merge "Create MemoryStorage wrapper around mw.SafeStorage" 2022-02-02 17:27:37 +00:00
jenkins-bot fabe580343 Merge "Limit where whitespaceParsoidHack() is used" 2022-02-02 17:25:02 +00:00
jenkins-bot 11892a9369 Merge "Remove unused code in JS modifier" 2022-02-02 17:21:37 +00:00
Ed Sanders 9e43f5c261 ReplyWidgetVisual: Fully clear sessionStorage when clearing
Clearing the widget removes all the surfaces, meaning there are
no doc-state variables to cleanup. Switch the order of these
two calls.

Change-Id: I6c095a171096cd700ce4cd31b08fa3b982ab2401
2022-02-02 16:46:57 +00:00
Ed Sanders cb5d585b93 Update wgCurRevisionId/wgRevisionId when refreshing the page
Change-Id: I2b1a7a6fe539a8a4bd5e3f865e4bb7464913d9e0
2022-02-02 16:46:57 +00:00
Ed Sanders dd9d37b555 Create MemoryStorage wrapper around mw.SafeStorage
This means we can guarantee we will be able to recover
auto-saves if we don't reload the page.

Change-Id: Ic867ae6df0c949f35cb32ec4b835688778db29ef
2022-02-02 14:59:47 +00:00
Bartosz Dziewoński fb474efb2b controller: Separate updating page contents from saving the page
Bug: T300502
Change-Id: I52c0a648ee15cc61890413a269708a6cb2bd4df8
2022-02-02 00:42:41 +01:00
Ed Sanders 7381d9d963 Cleanup CommentController and document
* Document all methods
* Rename comment to threadItem
* Use this.threadItem instead of passing in identical
  threadItem in various methods.
* Don't pass threadItem to ReplyWidget as we already
  pass the whole CommentController.

Change-Id: If9aad0bcf9f0e4ebf3342b75631ddac8b57f7d87
2022-02-02 00:05:19 +01:00
jenkins-bot 1fdefedc69 Merge "Clear autosave when following links from the legacy hint" 2022-01-31 20:16:21 +00:00
Ed Sanders 6af617ef99 CommentItem: Fix typo in documentation
Change-Id: I95fc9f4ca904a9315fc665618085c6c250b21a2e
2022-01-31 17:01:03 +00:00
Ed Sanders cb828828e2 controller: Fix typo in documentation
Change-Id: Ia68bcac6be0c59146655c5cbce872ea9b9304e37
2022-01-31 15:03:05 +00:00
Bartosz Dziewoński 15f0867b75 Limit where whitespaceParsoidHack() is used
* We don't need it anywhere in JS, since we're not sending that HTML
  to Parsoid.
* We only need it on the nodes directly containing our reply lines in
  PHP, not all over the place.

Change-Id: I0a04388225f32654dda2f599442cd27a303b5d0a
2022-01-29 22:42:46 +00:00
Bartosz Dziewoński bacf6a8fc6 Remove unused code in JS modifier
I don't think we're going to need this in the client again.

Change-Id: Id38405c14edfd7ac45afad8f32cad64594ae7bc0
2022-01-29 21:39:45 +00:00
David Lynch 3fdaf7ee58 Clear autosave when following links from the legacy hint
Bug: T299270
Change-Id: Ife590b4bea359168f07aa308128425cfb46f71cb
2022-01-27 11:48:42 -06:00
Bartosz Dziewoński 110a59200f One more tweak for comparing comment ranges to transclusion/DOM ranges
When we encounter a node that doesn't represent comment contents, e.g.:
* a [reply] link we inserted (T297034#7641334)
* an {{outdent}} template (see changed test case)

…we should ignore it together with its descendants (like in
Parser#nextInterestingLeafNode), instead of processing descendants
and possibly detecting comment contents in them.

Follow-up to 8de940b587,
72b9c2c6f5.

Bug: T297034
Change-Id: Ib2fa40c5fa389572b0e88ef558728fa06e3621b0
2022-01-24 17:42:18 +00:00
Bartosz Dziewoński f15693eefa Use class list everywhere for adding/checking CSS classes
In PHP, use DOMCompat::getClassList(), provided by Parsoid.
In JS, use `.classList`, available in all supported browsers.

This may fix some bugs where we were incorrectly checking for exactly
one class. The change in isOurGeneratedNode() is needed for
Ib2fa40c5fa389572b0e88ef558728fa06e3621b0.

Change-Id: Ia28d31678fd3d617b69280c4b7857755300fa515
2022-01-24 18:40:00 +01:00
jenkins-bot 5fa81c4123 Merge "Restore scrolling to comments when clicking a bundled notification" 2022-01-22 17:24:32 +00:00
Bartosz Dziewoński 35d6a0d853 Restore scrolling to comments when clicking a bundled notification
Follow-up to ebd37369ce.

Bug: T299813
Change-Id: Idd95f21921a89633f5d85aa993ba07aaab59ff20
2022-01-22 03:48:37 +01:00
jenkins-bot 4a0db2ae45 Merge "Add an optional suffix message to mentions" 2022-01-21 00:36:15 +00:00
Bartosz Dziewoński b019196e7a When using bullet syntax, hide the marker next to the reply tool
Bug: T259864
Change-Id: I47097c2b06f9deade7c234f08ebacb83d16a1d6d
2022-01-19 23:05:05 +01:00
David Lynch dccaa5bf65 Add an optional suffix message to mentions
Wikis like jawiki will then be able to customize the message to include
honorifics as they think appropriate.

Bug: T268588
Change-Id: I213fb9fd0a9ed6592ce3548a5b2c3b11a55c1abc
2022-01-19 10:29:10 -06:00
Bartosz Dziewoński faf6da62cc Ensure the marker appears in a reasonable place when replying with a bullet
Bug: T259864
Change-Id: I782460797ea78ab689cbab19c631f651315d2c8f
2022-01-12 22:57:48 +01:00
jenkins-bot 3699158e81 Merge "Handle selflinks by returning the current page's title" 2022-01-12 21:46:35 +00:00
jenkins-bot 7f329ca9a2 Merge "Enable wikis to customize the syntax used for replies" 2022-01-12 21:32:49 +00:00
Ed Sanders f80ff74fc6 Handle selflinks by returning the current page's title
Bug: T287818
Change-Id: I67f10ac9976581279d1e6a477e90d55875ebab20
2022-01-12 21:18: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
Bartosz Dziewoński 7b1053300a Enable wikis to customize the syntax used for replies
The following values for configuration variables are supported:
$wgDiscussionToolsReplyIndentation = 'invisible'; (default)
$wgDiscussionToolsReplyIndentation = 'bullet';

Bug: T259864
Change-Id: Icefad79630adc6ed35687498614e6a03ede1451b
2022-01-12 20:54:04 +00:00
jenkins-bot 20378e7be3 Merge "Ignore the watch star when replying to a transcluded comment" 2022-01-12 18:26:25 +00:00
jenkins-bot ed9fca9e5c Merge "Ensure [subscribe] buttons don't float too far away" 2022-01-12 15:06:11 +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
Ed Sanders 272b6595f5 Docs: Illustrate range overlaps in comment
Change-Id: If6f5d83719b8d078cd13327c0b9cbaef03f87508
2022-01-11 17:28:25 +00:00
Bartosz Dziewoński 72b9c2c6f5 Ignore some invisible nodes when looking for comment frames
Reimplement getFullyCoveredSiblings() using compareRanges(), which
checks basically the same thing, but works better and I like it more.

Bug: T297034
Change-Id: I33dc1d088bdee984064315290e378bfbfa830b10
2022-01-11 17:01:53 +00:00
jenkins-bot 7e61125c23 Merge "Work around a Safari bug causing shadows to remain when the popup is removed" 2022-01-11 16:14:15 +00:00
Bartosz Dziewoński 8de940b587 Improve detecting transcluded comments again
Previously: 569db3603c (2020-06).

Unfortunately we've found cases where the previous implementation
doesn't work correctly, resulting in comments being added to the wrong
pages or page corruption.

Bug: T289873
Bug: T298051
Change-Id: Id867b3005ebc46906d6df852a525fcaec9e6b19b
2022-01-11 16:07:44 +00: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 08d33f4ced Ignore the watch star when replying to a transcluded comment
Bug: T298917
Change-Id: I2523f5cf53151c4c32699ce0b0cadbcb7f9bd02d
2022-01-10 23:30:09 +01:00
jenkins-bot a627011ddf Merge "Use new wikipage.watchlistChange hook" 2022-01-10 22:21:17 +00:00
jenkins-bot ef13ceb9aa Merge "Fix some typos in doc comments" 2022-01-10 16:50:14 +00:00
Ed Sanders 9e98d72281 Fix collapsing whitespace in button section divider
Caused by inline-flex. These aren't used anywhere yet.

Change-Id: Ib9d407090d088e7c87112c22a3d8ae5bab5250c3
2022-01-09 00:42:25 +00:00
jenkins-bot e9155afea6 Merge "Filter username suggestions to accounts with edits" 2022-01-08 01:33:33 +00:00
Ed Sanders c3d54ec8a5 Fix styling of reply links when reply tool is open
To better support adding more links to the buttons group:
* Only disable the 'reply' link when the reply tool is open,
  not all links in the button group. If future links need
  to be disabled (e.g. 'edit') they can be done on a per-case
  basis.
* Add a 'separator' class for adding more links.
* Don't hide 'reply' link when in use. This feature was added
  very early on (I03a98495) and a long time before we started
  greying-out all reply links when the tool was open (I3bb5ad8e7).
  It would also lead to a strange display if there were
  other links in the button group. Instead change the link to
  black to indicate it is in use.

Change-Id: I23cc8d305d1d1c323cb69081749443f6e19de6a4
2022-01-07 17:09:15 +00:00
Bartosz Dziewoński 95c7824056 Fix closing the new topic tool hint
Bug: T298224
Change-Id: I32494990dd8e3bb8ffa2af097bc1f6400687c823
2021-12-23 19:59:33 +01:00
Ed Sanders 423983f26e Filter username suggestions to accounts with edits
Bug: T294774
Change-Id: I7346a7986d7caba473d31151495bb2263e43ca44
2021-12-22 23:57:15 +00:00
Bartosz Dziewoński 704148bd44 Ensure [subscribe] buttons don't float too far away
Set `overflow: hidden;` on the heading element to establish a new
block formatting context, which will contain floating elements.
Most skins already do this, but not Timeless.

https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context

Bug: T298069
Change-Id: Ic7afd82095b7440cf8b61b3f3fd0085e755a773e
2021-12-22 22:20:29 +01:00
Ed Sanders 238a6b49b4 Use new wikipage.watchlistChange hook
Bug: T294254
Depends-On: I88af8585e8fc75f77ebef867d267199aeb2c6592
Change-Id: Ic7201de567329b5752dcf52602602030d7c347f0
2021-12-21 13:00:48 +00:00
Ed Sanders 8c6fadeb65 Remove getHeading from HeadingItem (JS)
This matches the PHP implementation and was only used in
one place (when fetching authors in new topic tool).

Change-Id: I9d9e774616112e8dc6ab4919846e3abecc24553d
2021-12-21 01:33:50 +00:00
jenkins-bot 793c8e990e Merge "Implement getSubscribableHeading/isSubscribable in JS and use" 2021-12-20 21:49:03 +00:00