The subtitle prop and some others were missing from the action=parse
request. Use the same props as the VE edit API.
Change-Id: I8e9cc735d3ee50dfe0fbe0349713d88654ad9fd1
We cleared the highlight outside the setTimeout(), then set a new one
inside the setTimeout(). If this method was called twice quickly, two
highlights would be created, and the first one of them would become
impossible to clear.
Move the setTimeout() outside of the method to avoid this.
Bug: T311021
Change-Id: Ic8b2cf2a782a429c4ea073871efd215f4b300ed8
It's needed for the fix for T303396 to work correctly (in the case
where there's exactly 1 thread item on the page), and for the
highlight improvements in Iadbf83e02801fd9bd6336c84015994ee2819ce51.
Change-Id: I2b2f5535ebbf792910133622a271ac1491c74de6
Rather than making our own ThreadItem objects from scratch,
reuse those used by the rest of the code.
Change-Id: I67f5ea3ad26baffe51b66d0c75467ac00185dd0a
We switched to our memory-wrapped store everywhere outside the
VE surface, but not in the VE surface itself.
Change the way we construct MemoryStorage objects so that they can
be constructed from a specific mw.SafeStorage instance.
Ensure MemoryStorage's cache is populated with initial storage object
data, and that the cache is copied over when we create derivative
objectes.
Bug: T310438
Change-Id: I652428f114dc5169195887cb8ca719ae196bb76f
If the user can't edit, tell them why, instead of trying to
advise them to use the edit button that they cannot see.
Bug: T303110
Change-Id: Ibc41732a55443331e432987e630976610901c599
getPageData() had an optimization where, when it was called with
isNewTopic=true, it would skip querying 'linterrors' and
'transcludedfrom' data and return fake empty responses.
The issue is that they were cached, and then returned when it was
called with isNewTopic=false later.
Remove this optimization, as we make those queries anyway on init.
Change-Id: I1990b16f574c1aec385bd0fa46a9f39c6c2c1df2
Cases where saveSuccess wasn't logged:
* creating a new page with the New Topic tool
* any replies on mobile
* successful replies made through transclusions which then couldn't
purge the current page
These were all cases where we abandoned the post-save process early to
reload the page.
Bug: T305541
Change-Id: I1366a3e0a4b03ac67f926284f1aa718ae552d852
The CommentController stores a list of the new comments that
triggered the reload warning. Just highlight all the comments
in this list, as we always reload to the revision we got from
the same API call.
Bug: T303261
Change-Id: I960f3cf33e25004bad6ab6df907121a87555aaf4
Raise scope of pageThreads variable (renamed from `result`)
so we don't have to re-bind when it is updated, and use a
flag to ensure we only bind the handlers once.
Bug: T302810
Change-Id: I0a5b122b8e3f656f28f3dd4fa6aca8e7839be06b
Links are generated to:
* Single comments, by a user or by a notification
* Potentially multiple comments (new comments since T),
usually just by notifications.
If in either case no comments are found to highlight, warn the
user so they get some visual feedback that the notification worked
as expected, but that the comment was just deleted since.
Bug: T301602
Change-Id: I090c904481cf6f3e9f964fa43b10001e75b0bc90
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
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
Only show the reload prompt if the 'disappeared' error is detected
when the reply widget is loading. Don't show it if we failed
to save, as it suggests you will not lose content if you reload.
Change-Id: I106f274e180dc97b540d729e31aae575c43f29f0
* 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