Fix edit summary for comments in 0th section (no heading)

Bug: T245765
Change-Id: I9eb4726ef096b8d7459cc1409814514ec1dc89ae
This commit is contained in:
Bartosz Dziewoński 2020-02-20 21:24:07 +01:00
parent 4ee1ac11f0
commit 7761f62b42
3 changed files with 10 additions and 3 deletions

View file

@ -83,7 +83,7 @@ function autoSignWikitext( wikitext ) {
}
function postReply( widget, parsoidData ) {
var root, summary,
var root, summaryPrefix, summary,
comment = parsoidData.comment,
pageData = parsoidData.pageData,
newParsoidItem = modifier.addListItem( comment );
@ -94,9 +94,14 @@ function postReply( widget, parsoidData ) {
while ( root && root.type !== 'heading' ) {
root = root.parent;
}
if ( root.placeholderHeading ) {
// This comment is in 0th section, there's no section title for the edit summary
summaryPrefix = '';
} else {
summaryPrefix = '/* ' + root.range.startContainer.innerText + ' */ ';
}
summary = '/* ' + root.range.startContainer.innerText + ' */ ' +
mw.msg( 'discussiontools-defaultsummary-reply' );
summary = summaryPrefix + mw.msg( 'discussiontools-defaultsummary-reply' );
return mw.libs.ve.targetSaver.saveDoc(
parsoidData.doc,

View file

@ -670,6 +670,7 @@ function getComments( rootNode ) {
endOffset: 0
};
fakeHeading = {
placeholderHeading: true,
type: 'heading',
range: range,
level: 0

View file

@ -1,5 +1,6 @@
[
{
"placeholderHeading": true,
"type": "heading",
"range": [
"0",