mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Fix edit summary for comments in 0th section (no heading)
Bug: T245765 Change-Id: I9eb4726ef096b8d7459cc1409814514ec1dc89ae
This commit is contained in:
parent
4ee1ac11f0
commit
7761f62b42
|
@ -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,
|
||||
|
|
|
@ -670,6 +670,7 @@ function getComments( rootNode ) {
|
|||
endOffset: 0
|
||||
};
|
||||
fakeHeading = {
|
||||
placeholderHeading: true,
|
||||
type: 'heading',
|
||||
range: range,
|
||||
level: 0
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[
|
||||
{
|
||||
"placeholderHeading": true,
|
||||
"type": "heading",
|
||||
"range": [
|
||||
"0",
|
||||
|
|
Loading…
Reference in a new issue