Commit graph

1011 commits

Author SHA1 Message Date
Bartosz Dziewoński e5b44868f8 SubscriptionStore: Use InsertQueryBuilder for upsert
Change-Id: I66bc1de818eb367e5aa5adde7619a8ce6930bfc8
2023-10-21 23:12:17 +02:00
Subramanya Sastry 95c93adf40 Use ParserOutputAccess flags instead of ParsoidOutputAccess flags
ParsoidOutputAccess constants are deprecated and we want to remove them.

Change-Id: I105dbb1c599107d96111273ab106056090250984
2023-10-20 14:56:18 +00:00
Ed Sanders f8b76afef3 [BREAKING CHANGE] Remove isSectionEditable from overflow hook
Instead make isUneditableSection an optional property of
ContentHeadingItem.

Change-Id: Icfddf28aa789b5014ac183ff9f9699f38d78c121
2023-10-18 12:56:46 +01:00
Kosta Harlan 36c0b20c66 overflow menu: Display next to comments on desktop
Why:

- Per T338534, we want to display the overflow menu next to topics and
  comments. Supporting topic-level placement is a little more
  complicated, so just go with comments for now.

What:

- Rework the is-mobile check to allow the code to run on desktop/mobile,
  while excluding topic-level replacement on desktop (T342627)

Bug: T338534
Bug: T342625
Change-Id: I520c377120e16aa3a6fedcc8c39075958a942e4c
2023-10-18 11:37:18 +00:00
jenkins-bot 2cca063357 Merge "Distinguish between MobileFrontend and Minerva" 2023-10-17 20:24:28 +00:00
jenkins-bot eca326ede5 Merge "Support ignoring "mw-notalk" before/after/between comments" 2023-10-13 17:44:20 +00:00
jenkins-bot df863ad3b5 Merge "Fix truncating multibyte chars in section names" 2023-10-13 17:42:53 +00:00
Ed Sanders 81e690df8c Distinguish between MobileFrontend and Minerva
Change-Id: I7490190a6ddd3def502335b6dc2ec0d39477256b
2023-10-13 14:39:17 +01:00
jenkins-bot b4a95a6b5a Merge "overflow menu: Only show edit button in mobile" 2023-10-12 17:33:54 +00:00
Kosta Harlan ead2baf0f1 overflow menu: Only show edit button in mobile
Why:

- The button should only display for Minerva

What:

- Consult the skin name before adding the "Edit" button to the menu

Bug: T342251
Change-Id: I52cf2ca0663a4de0ee7add82910e745bcabf1c5f
2023-10-12 06:03:03 +00:00
Ed Sanders 52db0af5cf OverflowMenus: Don't pass 'editable' data to reply button overflows
'editable' refers to the section being editable, and is only for
use by heading items, not individual comments.

Change-Id: I3fb5841609c40a928071cea8987cf035ade464c2
2023-10-11 16:55:46 +01:00
jenkins-bot f9f9bf11f3 Merge "Always pass whole OutputPage (as IContextSource) to postprocess functions" 2023-10-09 18:05:54 +00:00
jenkins-bot f8b757bcae Merge "ThreadItemStore: Fix rows with itr_items_id=0 corrupted by T339882" 2023-10-09 15:34:55 +00:00
Ed Sanders 4447b6d201 Always pass whole OutputPage (as IContextSource) to postprocess functions
Change-Id: I07b312b8c00f9b5d20e285874ed0a0153949dd18
2023-10-09 15:41:28 +01:00
Bartosz Dziewoński f1edc47050 Support ignoring "mw-notalk" before/after/between comments
Since 92f5cfd8 we support "mw-notalk" to suppressing comment detection
in pages or sections.

Until now, it only worked when the comment timestamp was surrounded by
a marked element. However, when a marked element was directly adjacent
to a comment, it would sometimes become a part of the comment range.
This can no longer happen now.

Existing use cases for this were the {{outdent}} and {{tracked}}
templates, which we handle specially since 50ad5bb2 and ddd391b6.
It's a bit ugly to hardcode specific templates like that, and this
provides a better solution for the future. The added test case
displays some other potential uses.

Bug: T324132
Change-Id: I7ffd299ef5957b35da8d01f9a0ed5a7a9a78be83
2023-10-07 00:32:27 +00:00
jenkins-bot eef701da1e Merge "Add null check for str_starts_with" 2023-10-06 19:37:12 +00:00
Umherirrender 3aadcace2b Add null check for str_starts_with
Only needed for phan, under php8.1 this internal
function is deprecated about null.
The property $subscriptionName is not null when $subscriptionTitle is
not null and current code is safe, but phan cannot see the dependency
between both properties

Change-Id: I9e67309ec25a70c5de91d7f3e8f18447f205a4e4
2023-10-06 18:49:28 +02:00
Kosta Harlan 351891a063 overflow menu: Display menu next to comments on mobile
Why:

- We want to provide contextual actions adjacent to comments, not just
  topic headings.

What:

- Consolidate the logic for embedding the overflow menu button HTML into
  a function, and add this for both topic and comment items.
- For this patch, this is done only for mobile; in a follow-up patch, we
  can add support for desktop
- This doesn't use a feature flag as 1) no one is implementing the
  DiscussionTools hook yet, 2) the 'edit' menu item is disabled at the
  comment level. Merging this change would be a no-op until an extension
  implements the DiscussionToolsAddOverflowMenuItemsHook.

Bug: T342251
Change-Id: I15a151f151e2fa04398876b559d93d45c42f6ef6
2023-10-05 15:50:38 +01:00
Kosta Harlan c6c7dd2fb0 overflow menu: Add hooks for registering and interacting with items
Why:

- We want to allow extensions to register interactive menu items in the
  overflow menu.

What:

- Create a PHP hook to allow extensions to provide menu items
  for rendering in the overflow menu
  - The hook allows for registering resource loader modules required by
    the menu item
  - The hook passes in some contextual information, like the thread
    item data, context source object, and if the page is editable
- Create a JS hook that fires when a user selects one of the menu items
- Example implementation: Ie9afbedb4f24cbd75eb48bb21dc9f6d8d732d853

Misc:

- Remove b/c code that existed to handle a transitional period where
  JSON encoded overflow menu data did not necessarily exist in the
  parser cache
- Rename code instances of ellipsis button / data / menu to refer to
  "overflow menu"
  - Some renames will have to wait until parser cache is updated; these
    are noted with TODOs

Bug: T342251
Change-Id: I5f2a51791f8ba7619d1399a4b93111e9bb44e172
2023-10-05 15:50:33 +01:00
jenkins-bot 70c62667ce Merge "Turn comment timestamps into permalinks" 2023-10-02 21:06:09 +00:00
Bartosz Dziewoński 9fb16a40dc HookUtils: Fix checking page props
Follow-up to b4def00ed0.

Bug: T347878
Change-Id: Ia834b0f8d5cf48fce85e83af48d9fdcc789fc8e2
2023-10-02 16:59:57 +02:00
Ed Sanders b63884f561 Turn comment timestamps into permalinks
Bug: T275729
Change-Id: Ica9cfd9743a67fce170e8b078016fa79bf6fbb84
2023-10-02 14:53:47 +01:00
jenkins-bot 82bab7a4e6 Merge "Show new topics subscription button on history pages" 2023-09-26 17:40:55 +00:00
jenkins-bot e0b34b46d8 Merge "HookUtils: Fetch all needed props in one query" 2023-09-24 00:12:58 +00:00
Bartosz Dziewoński b4def00ed0 HookUtils: Fetch all needed props in one query
Bug: T347123
Change-Id: I54e5dfeb8ee07f0c3b6df4bffd2c6112cc1ad145
2023-09-23 06:35:49 +02:00
Bartosz Dziewoński 19fa706693 Action::getPageTitle() should return a Message
Bug: T343994
Change-Id: Ice968d8a5651a21260b9389526b4f7694b3deca8
2023-09-21 22:17:15 +02:00
Bartosz Dziewoński e825084546 SpecialPage::getDescription() should return a Message
Bug: T343994
Change-Id: I9902a7f0c2c74c34a887e4429f1de857bd087d28
2023-09-21 22:10:57 +02:00
Bartosz Dziewoński 97dbe19a34 ThreadItemStore: Fix rows with itr_items_id=0 corrupted by T339882
In T339882 we thought that these rows are harmless, but for the
specific case of itr_items_id that's not true.

Bug: T343859
Change-Id: Iebfa583d7d4b00a59291f91ec84c41241d5469d4
2023-09-21 03:51:48 +02:00
Bartosz Dziewoński 07df1ac620 Fix truncating multibyte chars in section names
Bug: T345648
Change-Id: I968c954aac94e3bbf8fa4a886f2422194ae0608f
2023-09-17 21:50:54 +00:00
Bartosz Dziewoński 6b633803c8 ThreadItemStore: Add details to row insertion exceptions
Bug: T343859
Change-Id: Ic0d741c192f42a3bd54276259820f25edcb0705b
2023-09-14 19:05:04 +00:00
Bartosz Dziewoński 70ff6fa463 SubscriptionStore: Tweak comment to fix Gerrit syntax highlighting
For some reason this apostrophe is treated like the start of a string
by Gerrit's syntax highlighting, messing up the whole file. It annoys
me very much.

Change-Id: Ie1ce88eefda6ae2a8a73237556affba4cbc6db4b
2023-09-14 17:58:16 +02:00
Bartosz Dziewoński 5d92dccafc TopicSubscriptionsPager: Handle invalid titles
This approach is borrowed from PageQueryPage in MediaWiki core,
and used in a few other places as well.

Bug: T345648
Change-Id: I7fbc3c3c1133da78eb9f15de9b2a51a90bcd1980
2023-09-05 23:40:52 +00:00
jenkins-bot 3a9bbd66a8 Merge "Hide ellipsis menu when the section is uneditable" 2023-09-05 22:44:49 +00:00
Ed Sanders 2c44828564 Hide ellipsis menu when the section is uneditable
Bug: T316388
Change-Id: I4a4f0888245ffa0c74935d24d8a64d2ed78080b7
2023-09-06 00:30:35 +02:00
jenkins-bot a1f2185a0f Merge "Acquire a temporary user username before previewing" 2023-08-30 13:15:05 +00:00
Ed Sanders 7dff37e354 Show new topics subscription button on history pages
Bug: T345096
Change-Id: I5da6ac0bca900f9fe3482d247d20aaf24feb61f2
2023-08-28 19:54:56 +01:00
Rajashree Talukdar bc495dfd10 DiscussionToolsDebug: check whether the given page exists
Check whether the page given to DiscussionToolsDebug exists or not.
Without the check, it throws Wikimedia\Assert\PreconditionException.
Add 'exists' => true in the getFormFields() array.

Bug: T338480
Change-Id: I57222f60cb5c5645e6bc97b86be22c502c85d650
2023-08-26 21:42:59 +05:30
jenkins-bot 3583d7367a Merge "Fix exception trying to store comments transcluded from special pages" 2023-08-24 16:36:40 +00:00
Bartosz Dziewoński 5c612862a1 Acquire a temporary user username before previewing
When rendering a preview of the comment in order to check whether it's
signed, use the previously acquired temporary user username for the
signature.

Depends-On: Iec8a15dadd595bed0f7e54f907fbb8e192b45cf3
Bug: T331397
Change-Id: I7aeb1cc4c107ed752dc805405780a7609a6d4d3c
2023-08-22 23:42:32 +02:00
Bartosz Dziewoński dd58d07ff5 Fix exception trying to store comments transcluded from special pages
Bug: T344622
Change-Id: I57dbd088dff15ac2cd9998663d7eac60dccd0dec
2023-08-21 19:02:42 +02:00
Umherirrender b160472953 Use namespace MediaWiki\Request\DerivativeRequest
Bug: T321681
Change-Id: Ia9e4557af6fc958d2c3e61cb876958540d25674b
2023-08-20 01:39:56 +02:00
Umherirrender fd0de6b09a Use namespaced Title
Bug: T321681
Change-Id: I66a498679d0743b7740887c636eca001efc170cd
2023-08-19 20:16:15 +02:00
gerritbot dfb413ed81 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I688fe73f46ecc2bbd8f4c59fc42b8e85fadf7689
2023-08-19 04:14:36 +00:00
Umherirrender 1a8ee0f3d1 Call IDatabase::insertId only when a row was inserted
As docs says on IDatabase::insertId

Change-Id: I4a61ce625c4f31316bb9eee83f293a438bac2e0e
2023-08-16 20:54:09 +02:00
jenkins-bot ca800cf631 Merge "Use UpdateQueryBuilder and InsertQueryBuilder" 2023-08-16 18:50:19 +00:00
jenkins-bot d28b11383e Merge "Make ApiDiscussionToolsEdit non-internal, add 'tags'" 2023-08-16 17:00:37 +00:00
Martin Urbanec 16ac49fe61 Make ApiDiscussionToolsEdit non-internal, add 'tags'
What:
Growth wants to use ApiDiscussionToolsEdit to
post questions on behalf of new users (to make use
of the auto-subscribing logic DiscussionTools has).

This seems like a good moment to make the API
non-internal.

What:
* Add support for 'tags' parameter
  (this doesn't actually work w/o the depends-on)
* Add autosubscribe parameter to give more control
  to callers over whether autosubscription is used.
* Remove isInternal()

Bug: T343339
Bug: T333632
Depends-On: I0ac60ca8473fe28461b2da60f9911baac4994388
Change-Id: I39727de40557d2494f4d60bf224490caaedfdee1
2023-08-16 16:52:38 +00:00
jenkins-bot a7b703c589 Merge "Use HookHandlers for BetaFeatures hook" 2023-08-16 08:51:41 +00:00
jenkins-bot de9ad429ee Merge "Use HookHandlers for Echo hook" 2023-08-16 05:26:09 +00:00
Umherirrender e5cbc838a8 Use HookHandlers for BetaFeatures hook
Bug: T273303
Change-Id: I685eb618b7ca2dc5b10bc5f08bfd235f682ff3c5
2023-08-16 05:23:25 +00:00