Commit graph

829 commits

Author SHA1 Message Date
Bartosz Dziewoński d223626585 Add signature on separate line if wikitext comment ends with a list
Bug: T263217
Change-Id: Idd15a9add798368493ae7af5270f972895470de9
2022-08-06 16:08:13 +02:00
Umherirrender 0a53b4d468 EventDispatcher: Remove use of UserFactory in logAddedComments
Possible since 1828d40

Change-Id: I0cc49a101858177bd9f7e75c18003277dd97725d
2022-08-05 01:43:16 +02:00
Ed Sanders ce567a1eeb Topic container latest comment link: Escape fragment for URL
Bug: T314573
Change-Id: Ib6a95da5d458efebf9e54c154ce90de3f54c140e
2022-08-04 14:28:23 +01: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 9c68e058ef CommentFormatter: Add test cases for mobile version
Also, rename the files, since CommentFormatter now does more than
replies.

Change-Id: I1ae432c06badd9790274db27881c2222c0439ba8
2022-08-02 14:21:36 +01: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
Bartosz Dziewoński 5b2f74ef5e CommentFormatter: Avoid serializing and parsing HTML repeatedly
Well, we still do it repeatedly, but now we repeat it one time less.

Change-Id: Ic1f655f32e4596d179f4154d90c2fe8286bf3de3
2022-08-02 00:32:24 +02:00
Bartosz Dziewoński 31c57d594a Do not duplicate item JSON in page HTML
Rather than setting it on both the reply link and the reply button,
set it on their parent element.

Update ReplyLinksController to handle this.

Change-Id: I650e9c0ebd354a82b8f66a63c5b4c02b2e29b105
2022-08-01 22:14:50 +00: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
Bartosz Dziewoński ddd391b6db Ignore "tracked" templates at the beginning of comments
This improves the behavior when replying to these comments
and the message snippets shown in notifications.

Bug: T313097
Change-Id: Ia10400472c9e999fa526c7437a03b72461c37b74
2022-07-31 03:56:36 +02:00
jenkins-bot a18c5c3e3a Merge "Don't show empty page state on redirect pages" 2022-07-28 22:26:11 +00: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
jenkins-bot 508e6446c5 Merge "API ThreadItemsHTML: improve generation of othercontent" 2022-07-28 21:56:56 +00:00
David Lynch ec0e2920ae API ThreadItemsHTML: improve generation of othercontent
Othercontent would often contain the opening tag of the next heading /
section. By looking for the closest node with a previousSibling we can
more-reliably escape the heading.

Also, only add the initial placeholder if there's content before the
first heading. We do this by testing for any siblings before the
startContainer of the first heading -- if there are any, assume this
means there's some sort of content. (This can still result in a
placeholder with `othercontent:""` if there's only whitespace before
the first heading.)

Bug: T313850
Change-Id: I080205b74413c46d3cf3442e79276145aaa9439c
2022-07-28 02:51:18 -05: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
Ed Sanders df1cd6be80 Prepend subscribe links to headings
This ensures they stay aligned with the top of the heading when text wraps.

Bug: T313406
Change-Id: Ifd8f93f63a1b3e3e4bd38a1d74f9afed647f7e68
2022-07-27 13:48:28 +01:00
Ed Sanders 6d9b0ec6b4 Show topic container even if heading is unsubscribable
Bug: T312140
Change-Id: Ie0412b9f238d5ff8e54fd2ea358c1c26e303f4e1
2022-07-23 01:21:52 +02:00
jenkins-bot d15a8c931a Merge "Separate ContentThreadItem and DatabaseThreadItem etc." 2022-07-19 16:03:02 +00: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 c3efa2fd89 ImmutableRange: Fix setStart/setEnd to avoid backwards range
The new behaviour better matches the DOM spec.

Change-Id: Ib795e99cdaeedfb1d9e03eb888dd0a243028a61e
2022-07-11 21:40:09 +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
jenkins-bot caefb1ae39 Merge "Show new topic tool empty state on existing pages with no topics too" 2022-07-07 21:52:36 +00: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
Bartosz Dziewoński 0735258101 LanguageData: Accept abbreviations in $wgLocaltimezone
Bug: T312310
Change-Id: I4a2952ef834450b4c07c129d32292591a15110fb
2022-07-07 03:12:20 +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
Bartosz Dziewoński 880f9755e0 Separate ContentThreadItem and DatabaseThreadItem etc.
Rename ThreadItem to ContentThreadItem, then create a new ThreadItem
interface containing only the methods that we'll be able to implement
using only the persistently stored data (no parsing), then create a
DatabaseThreadItem. Do the same for CommentItem and HeadingItem.

ThreadItemSet gets a similar treatment, but it's basically only for
Phan's type checking. (This is sad.)

Change-Id: I1633049befe8ec169753b82eb876459af1f63fe8
2022-07-04 23:35:50 +02:00
Reedy 54464f0b0c Add return type to jsonSerialize()
Bug: T311919
Change-Id: Ie77d7bc2902760972b8981a840bef91aae4ce5a3
2022-07-02 17:32:04 +00:00
jenkins-bot 32d4d879a8 Merge "Add some missing typehints" 2022-06-29 15:24:25 +00:00
Ed Sanders 4accd2fc7e Add some missing typehints
Change-Id: Idb111dd907972d9e02dab4b26c3fc106b12b1035
2022-06-29 15:15:52 +00:00
Bartosz Dziewoński af6e4a29eb ApiDiscussionToolsPageInfo: Fix fake headings with null name/id
name and id are supposed to never be null. Calling getName() or
getId() on this object would cause an exception.

Change-Id: I5f95b7d9e4ce4550b550ee758fc86f032b676731
2022-06-29 02:52:31 +02:00
Ed Sanders 639fabf647 Pass useskin/mobileformat when previewing/refreshing page contents
These are required to render content correctly on mobile.

Change-Id: I421e1f172e208c4bf9d50eee68f1b0220a78dfbe
2022-06-27 17:15:28 +01:00
Ed Sanders 904f1c2f25 Api: Make type/title required args of previewMessage
Change-Id: I0a0d9bfe3510d9bd6076408ba3819c82cd44ec0c
2022-06-27 12:50:10 +01:00
Ed Sanders 1b2517faf7 Show created/notified dates on Special:TopicSubscriptions
Extracted from patchset 29...28 of If96a0df1ef.

Also adds sorting functionality to sub_created
using the existing index on sub_id.

Bug: T294162
Change-Id: Ic4702c8c5a8119d9cdb4c3c99cf110626694777f
2022-06-26 22:42:44 +01:00
Ed Sanders 7fc5a0c29d Topic containers: Design iterations
Bug: T310914
Change-Id: I9000f9902d612c58c6b3bc8b762232ca6dd9724f
2022-06-25 12:54:39 +00:00
Ed Sanders 63acc121fc Thread containers: Link latest comment timestamp to corresponding comment
Bug: T309751
Change-Id: Id969bd7a76544d6024b8714c45cdfe5c59b71a0b
2022-06-24 21:44:21 +00:00
Ed Sanders b1be63469b Only enable visual enhancements in specific namespaces
Change-Id: I91643d3f07a9ee6f03a18f8e2787ab9cb61bc41d
2022-06-24 16:15:07 +01:00
Bartosz Dziewoński 109a50cb34 Truncate timestamps in comment IDs / names
For comments posted on or after 2022-07-12 (configurable), use a
shorter format, identical to the timestamps MediaWiki uses in URLs.

Changing the format for already existing comments would involve
difficult migrations, therefore we elect not to do it.

Bug: T304595
Change-Id: I387051a6a3a1d84cfae45c3e1516db870cc8b977
2022-06-24 00:49:58 +02: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 d59d5e14f9 CommentFormatter: Escape user input in generated comment
Currently the only user input in a headingItem name is the username
which can't contain a '>', so the regex can't break, but this is
fragile, and we should always do our own escaping.

Change-Id: I14e5ae2dc1e9ad7639e61b5471aa9ce270137960
2022-06-20 12:09:02 +01:00
jenkins-bot 80173ed010 Merge "Convert more self:: to static::" 2022-06-15 19:42:57 +00: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
Ed Sanders 0ad9b4c6b2 Move placeholder heading level (99) to a constant
Change the HeadingItem constructor to take a 'null' headingLevel
and store this internally with the constant. Change the JSON
serializer to convert this back to null.

Change-Id: I27508eed75d94b99c5189548919309f8da7deb75
2022-06-14 22:51:49 +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
Ed Sanders ab05e4e24f Add test coverage for ApiDiscussionToolsPageInfo::getThreadItemsHtml
Change-Id: I46a58f6a2ec5f0e1b750c67e85d27081f5fab544
2022-06-06 18:40:30 +01:00
David Lynch b4f829e5ca PageInfo threaditemshtml: include content before the first heading
Fake a placeholder heading for this, unless the first heading is already
a placeholder.

Bug: T304856
Change-Id: Icc12712f77e0c14139b289bec8cc3e0cb4834a43
2022-06-06 18:39:22 +01:00
David Lynch f668ee4989 PageInfo threaditemshtml: For empty headings, include their non-reply content
Bug: T304856
Change-Id: Ifbb7a843ce8a7d52a1b51d9fe16869e2f3ccbf1b
2022-06-06 18:37:59 +01: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
jenkins-bot e89b6d84af Merge "Use new ResourceLoader namespace" 2022-05-24 23:27:52 +00:00
Tim Starling 32dd490e7f Use new ResourceLoader namespace
Extensions using Phan need to be updated simultaneously with core due
to T308443.

Bug: T308718
Depends-On: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
Change-Id: Iffd8dea36f3b52181f3f3414a761d441d230b7b8
2022-05-24 23:00:00 +00: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
Bartosz Dziewoński 6a59149132 Ignore LRM and RLM in more places in the timestamp
We previously ignored them before timezone indicator (e9c401e3aa),
but they can end up in other places too, e.g. after the time.

Now we ignore them after every token. This is way overkill, but it
shouldn't hurt.

Bug: T308448
Change-Id: I20f7aaa34dba23f2a2faf1be258c1aea32ab770f
2022-05-17 02:00:22 +02:00
jenkins-bot 0b57fc6d66 Merge "Replace Action::getActionName by IContextSource::getActionName" 2022-04-20 00:15:27 +00:00
Umherirrender a979257396 Replace Action::getActionName by IContextSource::getActionName
Change-Id: If681252727a161d62444c8edbcd0cf447df1e765
2022-04-15 22:52:30 +02:00
Bartosz Dziewoński a31f022ba5 Remove limit on the number of topic subscriptions per user
We added the limit out of abundance of caution, because we were not
sure how the table is going to grow. We can see now that it's growing
slowly and reasonably.

Bug: T294881
Change-Id: I5da444c5d070926452e96ddbbe728b9e0375e466
2022-04-14 17:52:23 +00:00
Ed Sanders 91446d790e Empty state: Use self closing Html generators
Change-Id: I5352b064ac9e71df9f3f8791139944126b321436
2022-04-08 18:30:48 +01:00
gerritbot 731d530534 Fix usage of ApiBase::PARAM_* deprecated constants
The ones that are replaced with ParamValidator

Bug: T275455
Change-Id: I9ed72118c05cff879142ed89a3906c077413d25b
2022-04-04 00:40:51 +00:00
gerritbot 15fd46f064 Update use of deprecated constants in getAllowedParams()
Replacing StringDef ones

Bug: T275455
Change-Id: I9d1c7700f7c48112d9b2479733cc0fcd7ab6f7fe
2022-04-03 22:03:42 +02:00
jenkins-bot eb275b7810 Merge "Use namespaced VisualEditor traits and classes" 2022-03-29 21:01:28 +00:00
jenkins-bot fd6297b8a8 Merge "Remove data-mw-comment-name attribute from subscribe links" 2022-03-29 21:01:25 +00:00
jenkins-bot f7bdbee121 Merge "ApiDiscussionToolsEdit: Use CommentParser to get name/title of last topic" 2022-03-29 21:01:23 +00:00
jenkins-bot 5d2443c4bc Merge "ApiDiscussionToolsEdit: Add $preview- prefix to variables used in parsing preview" 2022-03-29 21:01:20 +00:00
jenkins-bot 8a00babfe2 Merge "ApiDiscussionToolsEdit: Use existing $this->commentParser reference" 2022-03-29 21:01:18 +00:00
Reedy 400d6227b8 Use namespaced VisualEditor traits and classes
Change-Id: I06eefd96068675607ed66a8a307d86c24d21f916
2022-03-29 20:32:44 +01:00
jenkins-bot 081fa1008a Merge "Use Sanitizer::stripAllTags() when generating notification snippets" 2022-03-28 22:42:39 +00:00
Ed Sanders 48fdcf1056 Remove data-mw-comment-name attribute from subscribe links
The HeadingItem's name is now present in the DOM, so just traverse
to it and use that instead.

Change-Id: If28e1588742513d606e3d8fcfb259b85acc0a873
2022-03-28 22:30:59 +01:00
Ed Sanders 43a04ab7ba ApiDiscussionToolsEdit: Use CommentParser to get name/title of last topic
This is a bit slower, but reduces logic duplication, and doesn't rely
on data-mw-comment-name, which we want to get rid of.

Change-Id: I79dc0937f3fc13677deb55b413796b54b747790e
2022-03-28 22:30:59 +01:00
Ed Sanders 5cc06baf2e ApiDiscussionToolsEdit: Add $preview- prefix to variables used in parsing preview
Avoids conflict with variables used later.

Change-Id: I0b74d4d041ae57e2ba18660da0871760bf5d5561
2022-03-28 22:30:41 +01:00
Ed Sanders 8bb41c9fb2 ApiDiscussionToolsEdit: Use existing $this->commentParser reference
Change-Id: I3e2b907103372e05de9035ab8058c0766cf39819
2022-03-28 18:30:36 +01:00
jenkins-bot a07871d7d7 Merge "Add item name to the JSON output of HeadingItem" 2022-03-25 11:51:42 +00:00
David Lynch 71049f4ce8 Add item name to the JSON output of HeadingItem
The name is needed for the topic subscription API

Bug: T285971
Change-Id: Iedbebdfd65d03ab01b22b35781803655749aa269
2022-03-25 11:45:50 +00:00
jenkins-bot 7e4727ed45 Merge "ImmutableRange: Fix Phan suppression" 2022-03-23 01:16:05 +00:00
jenkins-bot 35b3fd2fc0 Merge "CommentParser: Replace uses of Title with TitleValue" 2022-03-23 01:14:16 +00:00
jenkins-bot d91fe7aad0 Merge "CommentUtils: Fix isSingleCommentSignedBy() with empty heading" 2022-03-21 23:45:53 +00:00
Bartosz Dziewoński c5375e05b9 CommentUtils: Fix isSingleCommentSignedBy() with empty heading
Change the order of checks to ensure that we have at least one comment
before we try comparing ranges, to avoid issues with empty headings
having collapsed ranges. It should be a tiny bit faster this way, too.

Bug: T304377
Change-Id: I59ad30cfc075dcec882e048d2d199744efec2114
2022-03-22 00:12:42 +01:00
David Lynch 7275377b3c Talk API for apps
Exposed as DiscussionToolsPageInfo prop threaditemshtml. It returns a
version of the output of CommentParser, lightly adjusted to provide a
nested comment structure rather than a pure flat list.

Bug: T285971
Change-Id: I2f8503d4ed740a04fb2f1e3a37ae4db649b3faba
2022-03-21 16:40:45 -05:00
Bartosz Dziewoński 05996d71fe ImmutableRange: Fix Phan suppression
Change-Id: I9549ab3113e3255375e69e3337f3a4aadfa9b21e
2022-03-18 23:27:58 +00:00
Bartosz Dziewoński c7723baf72 CommentParser: Replace uses of Title with TitleValue
Another small step towards removing the reliance on global state.

Change-Id: Ifb4a5bcbef6606d02f1c7aa7385d72822cb0bad0
2022-03-18 18:24:34 +00: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 01b253c5b6 Don't allow the root node to be treated like a comment frame
Also fix a bug where headings would be ignored while checking for
comment frames. See task for detailed explanation.

Bug: T303396
Change-Id: I6495826b4b050ea80680e0798ac6ab4497a7c09e
2022-03-10 17:45:08 +00:00
jenkins-bot dd24b0edcd Merge "Improve handling for comments after fake headings using wikitext ;" 2022-03-10 16:21:18 +00:00
jenkins-bot 32d9ef573a Merge "CommentParser: Avoid using a dynamic undeclared property" 2022-03-10 00:22:16 +00:00
jenkins-bot 76478dda26 Merge "Move signatureScanLimit to a constant in JS" 2022-03-10 00:22:14 +00:00
Bartosz Dziewoński 4c29304484 CommentParser: Avoid using a dynamic undeclared property
Change-Id: Iefa8dea83bc0d31b9c6b3509189eeaa652dd9ea0
2022-03-08 23:30:11 +00:00
Bartosz Dziewoński 08c79142fb ImmutableRange: Add @property annotations for magic props
Phan can analyze them now and reports some issues with types.

* Add some assertions on types where we're sure that we're using an
  Element or non-null, but Phan can't prove it
* Fix incorrect type hints on getFullyCoveredSiblings() and
  getCoveredSiblings(), luckily it was harmless

Change-Id: I8cc12450378efa7434c4d66882378b715edd4a70
2022-03-08 23:29:40 +00:00
Bartosz Dziewoński eb1fe7a8fb CommentParser: Fix redundant uses of getHeadlineNodeAndOffset()
We call CommentUtils::getHeadlineNodeAndOffset() before constructing
the HeadingItem in CommentParser, so the range's startContainer
is always the headline node.

Change-Id: I2afb6ba9100e785cd91f31d82f4cea59fa8b5443
2022-03-08 23:29:34 +00:00
Bartosz Dziewoński 0e576216b2 CommentUtils: Fix confusing types in getIndentLevel()
Change-Id: I548cf4ad54e92c22da64caf53ee028a906cd3b62
2022-03-08 23:29:15 +00:00
Bartosz Dziewoński 584f6a020c Use tagName rather than nodeName when we know the node is an element
`tagName` is only defined on Element, and it returns its tag name.

`nodeName` is defined on Node, and it returns the tag name for Elements,
and a string like '#text' or '#document-fragment' for other types.

We were using both, which made it harder to reason about what types
we're dealing with.

Change-Id: I8e621e5872bdf78c84ec553cfbfcdbf0192f0589
2022-03-08 23:29:05 +00:00
Bartosz Dziewoński 063174e71c Use instanceof for checking for text/element nodes in PHP
It is friendlier for static analysis tools like Phan, which can't
infer anything from the `->nodeType === …` checks, and we were already
using it in most places.

Fix newly revealed Phan failures (and one unneeded suppression).

Change-Id: Id789f05e16a210f7ba22ca7514587c392fac0741
2022-03-08 23:28:39 +00:00
Bartosz Dziewoński 4134a80fdc Fix handling of disabled 'mobileformat'
Boolean parameters must be omitted completely if they're false.

Bug: T303262
Change-Id: Icc1bb4f557ce4de137f3e40b186074190f194dea
2022-03-08 14:00:22 +01:00
jenkins-bot 738e5461f8 Merge "Fix logic for finding the oldest comment in a bundle" 2022-03-08 02:23:57 +00:00
Ed Sanders 039d8e21e4 Fix logic for finding the oldest comment in a bundle
Follow-up to Ifba218871122901031a891034e709b886fc406da.

Bug: T302014
Change-Id: If1572a3ff13e922d86c0eca3d252cb196d329ea7
2022-03-08 02:13:54 +00:00
Reedy 524c8edf5c Use namespaced EventLogging class
Change-Id: Ic9f11b12edb5da08c2f4b31bea2a6517737ee6af
2022-03-06 16:10:40 +00:00
Bartosz Dziewoński b2ee19b441 Remove check for CDATA nodes
Added in 76289cdf73,
should no longer be needed since we switch to Parsoid's
HTML parser in 3e6ab2c4d2.

Change-Id: Ic0b7ed8089b71f2338e604f68d547759e069f0b2
2022-03-04 22:14:41 +01:00
Bartosz Dziewoński 0c59779126 CommentItem: Fix warning when the comment is empty
Bug: T302927
Change-Id: I5e92a71327e9563adb2427da62647a21244b803c
2022-03-03 19:35:11 +00:00
jenkins-bot 3c91a800ed Merge "Improve detecting already signed comments" 2022-03-02 14:14:13 +00:00
jenkins-bot 094b77b4bb Merge "Handle reply/topic preview entirely server-side" 2022-03-02 14:13:59 +00:00
jenkins-bot e15ccb8a07 Merge "Highlight all comments since the oldest in a thread bundle" 2022-02-28 23:24:12 +00:00
Ed Sanders dc8b4e8d4f Highlight all comments since the oldest in a thread bundle
For topic subscriptions, further restrict this to comments
in the same thread.

Bug: T302014
Change-Id: Ifba218871122901031a891034e709b886fc406da
2022-02-28 21:58:10 +00:00
jenkins-bot e4fa34f025 Merge "Don't insert comment markers inside replaced elements (like <video>)" 2022-02-28 17:16:11 +00:00
jenkins-bot 542da89530 Merge "Don't detect comments within references" 2022-02-28 16:47:21 +00: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
jenkins-bot e48e058202 Merge "Mobile config: Always enable reply/newtopic tools on mobile, disable subscriptions" 2022-02-22 22:30:38 +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
Ed Sanders d1b1745908 Avoid undefined index for mobileformat
Bug: T302344
Change-Id: I32844c61eeaf05771df2dd8b88e3c98f069cfada
2022-02-22 21:24:19 +00:00
Bartosz Dziewoński 1e3ce9c88a Don't insert comment markers inside replaced elements (like <video>)
Also special-case thumbnail wrappers generated by
MediaTransformOutput::linkWrap, for compatibility with
TimedMediaHandler.

Bug: T301427
Bug: T302296
Change-Id: I7f48d8b2261507c5a33526c54109f5187d062ed3
2022-02-22 15:11:34 +00:00
Bartosz Dziewoński 8a2715bdd5 Move signatureScanLimit to a constant in JS
Change-Id: Ieb60c148fd060ab62e4a493e2d0dff6c051f945c
2022-02-21 22:42:14 +01:00
Bartosz Dziewoński 0ecc8a4c05 Improve detecting already signed comments
Previously, we required a signature at the end of the comment.
This was a pretty rough heuristic that did not correctly handle
many comments that we would consider entirely properly signed
in CommentParser (e.g. comments wrapped in formatting like
<small>…</small>, comments with a post-scriptum or in parentheses,
or comments generated by various templates).

Now we process the user input using the same code that adds reply
links, and only add a signature when we detect that there really
isn't a signature (including template-generated), or if the signature
is in the wrong place and would result in the reply link showing up
in the wrong place as well (not at the end of the comment).

Bug: T278442
Bug: T268558
Bug: T278355
Bug: T291421
Bug: T282983
Change-Id: I46b6110af328ebdf93b7dfc2bd941e04391a1599
2022-02-21 21:21:26 +00:00
Bartosz Dziewoński 4244418e56 Don't detect comments within references
Bug: T301213
Change-Id: Ifd5198651c8ed0ce53379fb5e35938089cd54a09
2022-02-21 19:57:44 +00:00
jenkins-bot 1a48f8cd7e Merge "CommentParser: Inject a forgotten service" 2022-02-21 19:30:55 +00:00
Bartosz Dziewoński 85165543f4 CommentParser: Inject a forgotten service
Also sort alphabetically.

Change-Id: I9e77c4aa1fba930f382e3c4f17ac0504c2f06668
2022-02-21 20:15:54 +01:00
Bartosz Dziewoński aea36bab3a CommentParser: Fix a small use of global state
Also, in ThreadItem::getSinglePageTransclusionTitle(), we don't need
this terribly complicated method.

Change-Id: If02c09aaa2f4dd66b2bc253a1edec4ea107564ee
2022-02-21 18:15:31 +00:00
Bartosz Dziewoński 1d43a024f9 Handle reply/topic preview entirely server-side
We were rendering the preview in a completely different way from how
we would add the real reply, and the results would be different
sometimes, particularly for multi-line comments with messed-up markup.

Render it server-side instead, in a very similar way to real replies
(generating a DOM list node and transforming it through Parsoid),
although without the whole context of the page to improve performance.

We can remove a lot of client-side code that was used solely for this.

This will allow the preview to accurately display the signatures when
we change how they are added (T278442), without us having to implement
those changes again from scratch for the preview.

Change-Id: I53341f4d4075c25b67ec3b3032bff9b8a880dcd3
2022-02-21 17:42:28 +01:00
jenkins-bot aeabff63c9 Merge "Split off ThreadItemSet from CommentParser" 2022-02-21 16:33:58 +00:00
Bartosz Dziewoński 8e44b43df0 Split off ThreadItemSet from CommentParser
Goal:
-----
Finishing the work from Iadb7757debe000025e52770ca51ebcf24ca8ee66
by changing CommentParser::parse() to return a data object, instead of
the whole parser.

Changes:
--------
ThreadItemSet.php:
ThreadItemSet.js:
* New data class to access the results of parsing a discussion. Most
  methods and properties are moved from CommentParser with no changes.

CommentParser.php:
Parser.js:
* parse() returns a new ThreadItemSet.
* Remove methods moved to ThreadItemSet.
* Placeholder headings are generated slightly differently, as we process
  things in a different order.
* Grouping threads and computing IDs/names is no longer lazy. We always
  needed IDs/names anyway.
* computeId() explicitly uses a ThreadItemSet to check the existing IDs
  when de-duplicating.

controller.js:
* Move the code for turning some nodes annotated by CommentFormatter
  into a ThreadItemSet (previously a Parser) from controller#init to
  ThreadItemSet.static.newFromAnnotatedNodes, and rewrite it to handle
  assigning parents/replies and recalculating legacy IDs more nicely.
* mw.dt.pageThreads is now a ThreadItemSet.

Change-Id: I49bfe019aa460651447fd383f73eafa9d7180a92
2022-02-21 16:22:32 +00:00
jenkins-bot b6e930a101 Merge "Change CommentParser into a service" 2022-02-20 14:01:11 +00:00
jenkins-bot ff6dbe0ed1 Merge "CommentParser: Remove unused method getThreadItemsByName()" 2022-02-20 13:45:06 +00:00
jenkins-bot c29c1eebd2 Merge "Split Data class into ResourceLoaderData and LanguageData" 2022-02-20 13:44:56 +00:00
jenkins-bot 4713986eb7 Merge "Various code quality tweaks" 2022-02-20 13:27:10 +00:00
Bartosz Dziewoński 4613ae78e7 Change CommentParser into a service
Goal:
-----
To have a method like CommentParser::parse(), which just takes a node
to parse and a title and returns plain data, so that we don't need to
keep track of the config to construct a CommentParser object (the
required config like content language is provided by services) and
we don't need to keep that object around after parsing.

Changes:
--------
CommentParser.php:
* …is now a service. Constructor only takes services as arguments.
  The node and title are passed to a new parse() method.
* parse() should return plain data, but I split this part to a separate
  patch for ease of review: I49bfe019aa460651447fd383f73eafa9d7180a92.
* CommentParser still cheats and accesses global state in a few places,
  e.g. calling Title::makeTitleSafe or CommentUtils::getTitleFromUrl,
  so we can't turn its tests into true unit tests. This work is left
  for future commits.

LanguageData.php:
* …is now a service, instead of a static class.

Parser.js:
* …is not a real service, but it's changed to behave in a similar way.
  Constructor takes only the required config as argument,
  and node and title are instead passed to a new parse() method.

CommentParserTest.php:
parser.test.js:
* Can be simplified, now that we don't need a useless node and title
  to test internal methods that don't use them.

testUtils.js:
* Can be simplified, now that we don't need to override internal
  ResourceLoader stuff just to change the parser config.

Change-Id: Iadb7757debe000025e52770ca51ebcf24ca8ee66
2022-02-19 19:51:57 +01:00
Bartosz Dziewoński f51f3a1051 CommentParser: Remove unused method getThreadItemsByName()
Follow-up to a5099739a6.

Change-Id: I53cbf6a7a2c9b95674998734689b3930dfe74149
2022-02-19 19:51:57 +01:00
Bartosz Dziewoński 99b5de8038 Split Data class into ResourceLoaderData and LanguageData
The Data class contained utilities for two unrelated purposes.
Split each half to a separate class.

Notably, this improves the signature of the getLocalData() function.

Change-Id: Icde615fb9d483fee1f352c34909b37f8ffde8081
2022-02-19 19:37:34 +01:00
Bartosz Dziewoński ae9f26a9e5 Various code quality tweaks
(suggested by PhpStorm)

composer.json:
* Document required PHP extensions

Parser.js:
* Remove incorrect param documentation
* Fix some typos in comments (missing parentheses)

CommentParser.php:
* Fix some typos in comments (missing parentheses)

ImmutableRange.php:
* Remove unused property
* Add a `throw` to indicate that code path is unreachable

SubscribedNewCommentPresentationModel.php:
* Add missing `return false`

CommentParserTest.php:
* Remove unnecessary pass-by-reference

CommentModifierTest.php:
* Remove unused variable

CommentParserTest.php:
* Don't construct Element objects directly. PHP's DOMElement allows
  it, but Parsoid/Dodo's doesn't, and we use the latter for static
  analysis. This generates all kinds of confusing warnings.

Change-Id: Ia9598ebea0e99830dd485296e94a9d96acc4b258
2022-02-19 19:36:52 +01:00
Ed Sanders d1e56c7dc5 ApiDiscussionToolsEdit: Pass useskin & mobileformat to ApiVisualEditorEdit
From there they are passed on ApiParse.

Change-Id: I8411379694961868c2540c42739fb4f5d7b61972
2022-02-18 16:40:38 +00:00
David Lynch 7094cc592c Don't autosubscribe flagged bots
Bug: T301933
Change-Id: Icabee260a16ed2686a95250bad2aa1b92881566e
2022-02-17 11:54:14 -06:00
David Lynch d1e62d364d Log talk_page_edit events for adding a new topic
Bug: T301496
Change-Id: I618339f254c89db45891ee403f037c555afdda6e
2022-02-14 11:48:16 -06:00
Bartosz Dziewoński e414d1acaf Improve handling for comments after fake headings using wikitext ;
Bug: T265964
Change-Id: I77db68928c5426fd885a277eec52c6e164d559bb
2022-02-11 23:35:32 +00:00
Bartosz Dziewoński 91e1bb15cc Use Sanitizer::stripAllTags() when generating notification snippets
It adds white-space between block tags and strips invisible tags.

It may be slightly slower (it takes HTML as input rather than DOM, so
we need to serialize the HTML first and then call it, rather than only
find and concatenate text nodes), but the difference is negligible,
and it seems better to use this method than to try to re-implement it.

Test runtime went from ~9.0s to ~9.5s locally, when testing using:
  php tests/phpunit/phpunit.php \
  extensions/DiscussionTools/tests/phpunit/ThreadItemTest.php \
  --filter getText

Bug: T219138
Change-Id: I0cb89ebd2160e1ef499b78573c6688f493a4c42f
2022-02-10 22:23:24 +01:00
jenkins-bot 8bcaf75372 Merge "Replace use of deprecated OutputPage::enableClientCache( false )" 2022-02-10 07:01:26 +00:00
jenkins-bot aa64257169 Merge "Don't refer to non-existent fields when using 'hide-if'" 2022-02-09 15:37:30 +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
jenkins-bot 9b2b887675 Merge "ThreadItem: Use DOMUtils to get HTML of DocumentFragment" 2022-02-09 00:53:43 +00:00
Ed Sanders 16c24d6f0a ThreadItem: Use DOMUtils to get HTML of DocumentFragment
This fixes a warning this was thrown when the fragment
was empty (e.g. a placeholder heading).

Change-Id: I5d44993014280b210f48be6be8db0c58ab8e0352
2022-02-08 23:51:38 +00:00
jenkins-bot e8e9ba5f98 Merge "Fix some typos in comments" 2022-02-08 20:00:11 +00:00
jenkins-bot 4593a9fe91 Merge "Don't count leading/trailing whitespace against signature scan limit" 2022-02-08 20:00:08 +00:00
Ed Sanders aa03dc971e Add discussiontoolscompare API
For two given revisions, this API tells us which comments have
been added and which have been removed.

Can be used to highlight new comments, or check if the page
has been updated since we first loaded it.

Bug: T281624
Bug: T300504
Change-Id: Ia4d95ffe3b7cf2317cd8e7c0f034e09f64777ef3
2022-02-08 15:53:27 +00:00
jenkins-bot 6a23be0bb5 Merge "Move ApiDiscussionTools to ApiDiscussionToolsPageInfo" 2022-02-07 20:43:26 +00:00
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
jenkins-bot c86029397e Merge "Remove DiscussionToolsEnableTopicSubscriptionBackend config" 2022-02-05 00:49:17 +00:00
Bartosz Dziewoński 5945a4a0eb Fix some typos in comments
Change-Id: I699d9d105b8706cef0800ccc086cde687de54078
2022-02-04 20:36:28 +01:00
Bartosz Dziewoński 13ab1db6da Don't count leading/trailing whitespace against signature scan limit
It's an arbitrary limit, it seems harmless to relax it to support the
use case in the task, even if it's weird.

Bug: T300949
Change-Id: I7c895c7019726758bbae3183b9c3ecbd9eabcf38
2022-02-04 19:35:29 +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
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
Bartosz Dziewoński 165ca9b847 Improve CommentModifier::addReply() API for re-use and testing
Goal: To be able to re-use or test the transformations we previously
  performed in addWikitextReply() / addHtmlReply(), without requiring
  a Comment object or adding the result as a reply.

Change-Id: I040c4be9b6b9bddba661f30fd0566f8850673074
2022-02-03 21:12:48 +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 6572e108f9 Remove empty lines in visual mode in some more cases
After switching from source mode to visual mode, there will be some
Parsoid-generated white space between block nodes, which remains when
the reply is posted in visual mode.

Follow-up to e064f43499.

Bug: T300439
Change-Id: Ia5d2c06f0a4125e9f148eddd3235f95138c9d37f
2022-01-29 22:42:41 +00:00
jenkins-bot 0b52563b53 Merge "One more tweak for comparing comment ranges to transclusion/DOM ranges" 2022-01-24 23:37:07 +00:00
jenkins-bot 4679dd27b3 Merge "Use class list everywhere for adding/checking CSS classes" 2022-01-24 23:37:05 +00: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
Bartosz Dziewoński 5919e4e371 Don't try to parse section titles as wikitext in subscription notifs
Bug: T299572
Depends-On: Idb3a87fd18330f90a8cdc1276994d54288e17b28
Change-Id: I3b58f337bb2ea1f5255fc0a41dbd7a5ad8c433db
2022-01-21 00:12:58 +01:00
Bartosz Dziewoński d2405cc11c Simplify handling of sections in bundled notification links
This code previously ensured that the fragment identifier linking
to a section was only included if all events had the same section.
It doesn't actually seem worth the effort, since we handle scrolling
to the highlighted comments client-side anyway.

And the links were not quite correct, because we didn't parse and
strip the section title as expected by built-in Echo events. Just
use Echo's code for this.

Depends-On: Idb3a87fd18330f90a8cdc1276994d54288e17b28
Change-Id: Icae0d3654dd02109337ff8737b16f55bbd514f43
2022-01-21 00:06:36 +01:00
Bartosz Dziewoński 8f937eb9da Prevent assertion failure caused by empty headings
Follow-up to 8de940b587.
See also 8b426c7e5c.

Bug: T299583
Change-Id: Ibd2c459330cfc7664bd36d7840209779450d72d4
2022-01-20 18:56:32 +00:00
jenkins-bot 5181d099ab Merge "PreferenceHooks: Don't call saveSettings in LocalUserCreated" 2022-01-12 21:58:04 +00: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
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 f189c985da Merge "Fix placeholder headings causing exceptions in getTranscludedFrom()" 2022-01-12 17:18:55 +00: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
Bartosz Dziewoński 8b426c7e5c Fix placeholder headings causing exceptions in getTranscludedFrom()
Follow-up to 8de940b587.

Change-Id: Iddf045105fac6ab8cdaa933fd2abcf6dbbd37d42
2022-01-11 23:24:45 +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
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
Bartosz Dziewoński 492dbd7847 Fix inserting comment start markers when they're outside of any wrappers
Comment boundaries are stored as a DOM parent node plus a child index.
Because of that, inserting anything into the DOM before a comment –
such as another comment's start/end markers – would cause us to insert
subsequent comments' markers into the wrong places.

This issue didn't affect many pages, because usually any parent node
would have just one comment in it. Only pages with comment boundaries
outside of any wrappers (directly inside the root node) were broken.

Just process the list in reverse to fix this.

Bug: T298096
Change-Id: Iccffc36b71e9fcf3d72c4db2b9459d39042f7a2d
2022-01-11 16:07:37 +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
Alexander Vorwerk 397dc2cea5 Replace usages of deprecated wfWikiID()
The global function wfWikiID() is deprecated since 1.35 and it's usages
should be replaced with WikiMap::getCurrentWikiId().

Bug: T298059
Change-Id: Ie878a5479b7427e9ffab7d7f92ee2802997e3161
2021-12-21 01:45:54 +00:00
Umherirrender d32dcfbb3c Use ParserOptions::newFromAnon instead of ParserOptions::newCanonical
ParserOptions::newCanonical is deprecated.

Change-Id: I26667c9102c37d962ceaa81c082566819b503744
2021-12-18 20:15:02 +01:00
jenkins-bot fb16305135 Merge "Show a hint on legacy interface when arriving from new topic tool hint" 2021-12-17 17:30:39 +00:00
jenkins-bot e568c62f85 Merge "Show a hint on the new topic tool to explain that it's new" 2021-12-17 17:30:37 +00:00
jenkins-bot be07ec8cfc Merge "Add Range::compareBoundaryPoints" 2021-12-17 16:48:04 +00:00
jenkins-bot c4fb0f7046 Merge "Change auto topic subs to re-subscribe you if you unsubscribed" 2021-12-17 15:32:40 +00:00
jenkins-bot 0f32a760b4 Merge "Move some helpers from CommentParser to CommentUtils" 2021-12-17 01:02:26 +00:00
Bartosz Dziewoński 12aa136f54 Add Range::compareBoundaryPoints
Change-Id: I7b8b9f196bb1ed95304d8b7755d51246c4515bc9
2021-12-17 00:55:00 +00:00
Ed Sanders 4a88be8084 Move user subscription limit to config
This makes it easier to change going forward, and
configurable on 3rd party wikis.

Bug: T294881
Change-Id: I9e5343cab42cb00ed6b62cf5adf9e02b072481f1
2021-12-16 21:07:40 +01:00