mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Merge "Warn when target comments in a link can't be found"
This commit is contained in:
commit
0dc293fc20
|
@ -121,6 +121,8 @@
|
||||||
"discussiontools-replylink",
|
"discussiontools-replylink",
|
||||||
"discussiontools-replywidget-loading",
|
"discussiontools-replywidget-loading",
|
||||||
"discussiontools-replywidget-watchthis",
|
"discussiontools-replywidget-watchthis",
|
||||||
|
"discussiontools-target-comment-missing",
|
||||||
|
"discussiontools-target-comments-missing",
|
||||||
"discussiontools-topicsubscription-button-subscribe",
|
"discussiontools-topicsubscription-button-subscribe",
|
||||||
"discussiontools-topicsubscription-button-subscribe-tooltip",
|
"discussiontools-topicsubscription-button-subscribe-tooltip",
|
||||||
"discussiontools-topicsubscription-button-unsubscribe",
|
"discussiontools-topicsubscription-button-unsubscribe",
|
||||||
|
|
|
@ -99,6 +99,8 @@
|
||||||
"discussiontools-replywidget-transcluded": "Your comment will be saved at [[$1]].",
|
"discussiontools-replywidget-transcluded": "Your comment will be saved at [[$1]].",
|
||||||
"discussiontools-replywidget-watchthis": "Add this page to your [[Special:Watchlist|watchlist]]",
|
"discussiontools-replywidget-watchthis": "Add this page to your [[Special:Watchlist|watchlist]]",
|
||||||
"discussiontools-signature-prefix": " ",
|
"discussiontools-signature-prefix": " ",
|
||||||
|
"discussiontools-target-comment-missing": "This comment could not be found. It might have been deleted or moved.",
|
||||||
|
"discussiontools-target-comments-missing": "New comments could not be found. They might have been deleted or moved.",
|
||||||
"discussiontools-topicsubscription-action-unsubscribe-button": "Unsubscribe",
|
"discussiontools-topicsubscription-action-unsubscribe-button": "Unsubscribe",
|
||||||
"discussiontools-topicsubscription-action-unsubscribe-prompt": "Unsubscribe from this topic?",
|
"discussiontools-topicsubscription-action-unsubscribe-prompt": "Unsubscribe from this topic?",
|
||||||
"discussiontools-topicsubscription-button-subscribe": "subscribe",
|
"discussiontools-topicsubscription-button-subscribe": "subscribe",
|
||||||
|
|
|
@ -110,6 +110,8 @@
|
||||||
"discussiontools-replywidget-transcluded": "Message explaining that the comment will be saved on a different page than the one you're viewing right now (because it was transcluded from it). Parameter: $1 – page name",
|
"discussiontools-replywidget-transcluded": "Message explaining that the comment will be saved on a different page than the one you're viewing right now (because it was transcluded from it). Parameter: $1 – page name",
|
||||||
"discussiontools-replywidget-watchthis": "Label for a checkbox in the reply widget. It is used instead of the usual {{msg-mw|watchthis}} to distinguish the watchlist functionality from [[mw:Talk_pages_project/Feature_summary#Topic_subscriptions|topic subscriptions]].\n{{Identical|Add this page to your watchlist}}",
|
"discussiontools-replywidget-watchthis": "Label for a checkbox in the reply widget. It is used instead of the usual {{msg-mw|watchthis}} to distinguish the watchlist functionality from [[mw:Talk_pages_project/Feature_summary#Topic_subscriptions|topic subscriptions]].\n{{Identical|Add this page to your watchlist}}",
|
||||||
"discussiontools-signature-prefix": "{{optional}}\nWikitext that prefixes the signature. The prefix and signature will be appended directly to the message, so this must include a leading space if a gap is desired.\n\nThis message intentionally doesn't use the prefix from {{msg-mw|sig-text}}, because it is not actually commonly used on many wikis, but you can include it in the translation if that is the convention in your language.\n{{Format|plain}}",
|
"discussiontools-signature-prefix": "{{optional}}\nWikitext that prefixes the signature. The prefix and signature will be appended directly to the message, so this must include a leading space if a gap is desired.\n\nThis message intentionally doesn't use the prefix from {{msg-mw|sig-text}}, because it is not actually commonly used on many wikis, but you can include it in the translation if that is the convention in your language.\n{{Format|plain}}",
|
||||||
|
"discussiontools-target-comment-missing": "Message shown in a popup when the user follows a link that would highlight a '''single''' comment on a talk page, e.g. [https://en.wikipedia.org/wiki/User_talk:Example#c-Example1-2019-06-26T08:00:00.000Z-Example_discussion_title], but the comment doesn't exist on the page any more. Such links are used in notifications, or can be used in comments by other users.\n\nSee also for multiple comments: {{msg-mw|discussiontools-target-comments-missing}}",
|
||||||
|
"discussiontools-target-comments-missing": "Message shown in a popup when the user follows a link that would highlight potentially '''multiple new''' comments on a talk page, but the exact number is unknown, e.g. [https://en.wikipedia.org/w/index.php?title=User_talk:Example&dtnewcommentssince=c-Example1-2019-06-26T10:20:00.000Z-Example2-2019-06-26T10:10:00.000Z], but none of these comments exist on the page any more. Such links are generated by notifications.\n\nSee also for a single comments: {{msg-mw|discussiontools-target-comment-missing}}",
|
||||||
"discussiontools-topicsubscription-action-unsubscribe-button": "Button to unsubscribe from a topic.\n{{identical|Unsubscribe}}",
|
"discussiontools-topicsubscription-action-unsubscribe-button": "Button to unsubscribe from a topic.\n{{identical|Unsubscribe}}",
|
||||||
"discussiontools-topicsubscription-action-unsubscribe-prompt": "Prompt shown when about to unsubscribe from a topic on an action page.",
|
"discussiontools-topicsubscription-action-unsubscribe-prompt": "Prompt shown when about to unsubscribe from a topic on an action page.",
|
||||||
"discussiontools-topicsubscription-button-subscribe": "Label for the subscribe link added to each section. Use the same casing as section edit links.\n\nAppears in the same area as:\n* {{msg-mw|editsection}}\n* {{msg-mw|visualeditor-ca-editsource-section}}\n* {{msg-mw|discussiontools-topicsubscription-button-unsubscribe}}\n* {{msg-mw|discussiontools-replylink}}",
|
"discussiontools-topicsubscription-button-subscribe": "Label for the subscribe link added to each section. Use the same casing as section edit links.\n\nAppears in the same area as:\n* {{msg-mw|editsection}}\n* {{msg-mw|visualeditor-ca-editsource-section}}\n* {{msg-mw|discussiontools-topicsubscription-button-unsubscribe}}\n* {{msg-mw|discussiontools-replylink}}",
|
||||||
|
|
|
@ -513,6 +513,7 @@ function updateSubscriptionStates( $container, headingsToUpdate ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var $highlightedTarget = null;
|
var $highlightedTarget = null;
|
||||||
|
var missingTargetNotifPromise = null;
|
||||||
/**
|
/**
|
||||||
* Highlight the comment(s) on the page associated with the URL hash or query string
|
* Highlight the comment(s) on the page associated with the URL hash or query string
|
||||||
*
|
*
|
||||||
|
@ -527,6 +528,12 @@ function highlightTargetComment( threadItemSet, noScroll ) {
|
||||||
$highlightedTarget.remove();
|
$highlightedTarget.remove();
|
||||||
$highlightedTarget = null;
|
$highlightedTarget = null;
|
||||||
}
|
}
|
||||||
|
if ( missingTargetNotifPromise ) {
|
||||||
|
missingTargetNotifPromise.then( function ( notif ) {
|
||||||
|
notif.close();
|
||||||
|
} );
|
||||||
|
missingTargetNotifPromise = null;
|
||||||
|
}
|
||||||
// eslint-disable-next-line no-jquery/no-global-selector
|
// eslint-disable-next-line no-jquery/no-global-selector
|
||||||
var targetElement = $( ':target' )[ 0 ];
|
var targetElement = $( ':target' )[ 0 ];
|
||||||
|
|
||||||
|
@ -538,6 +545,15 @@ function highlightTargetComment( threadItemSet, noScroll ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( location.hash.match( /^#c-/ ) && !targetElement ) {
|
||||||
|
missingTargetNotifPromise = mw.loader.using( 'mediawiki.notification' ).then( function () {
|
||||||
|
return mw.notification.notify(
|
||||||
|
mw.message( 'discussiontools-target-comment-missing' ).parse(),
|
||||||
|
{ type: 'warn', autoHide: false }
|
||||||
|
);
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
var uri;
|
var uri;
|
||||||
try {
|
try {
|
||||||
uri = new mw.Uri( location.href );
|
uri = new mw.Uri( location.href );
|
||||||
|
@ -567,6 +583,9 @@ function highlightTargetComment( threadItemSet, noScroll ) {
|
||||||
function highlightNewComments( threadItemSet, noScroll, newCommentIds, newCommentsSinceId, inThread ) {
|
function highlightNewComments( threadItemSet, noScroll, newCommentIds, newCommentsSinceId, inThread ) {
|
||||||
newCommentIds = newCommentIds || [];
|
newCommentIds = newCommentIds || [];
|
||||||
|
|
||||||
|
var highlightsRequested = newCommentIds.length || newCommentsSinceId;
|
||||||
|
var highlightsRequestedSingle = !newCommentsSinceId && newCommentIds.length === 1;
|
||||||
|
|
||||||
if ( newCommentsSinceId ) {
|
if ( newCommentsSinceId ) {
|
||||||
var newCommentsSince = threadItemSet.findCommentById( newCommentsSinceId );
|
var newCommentsSince = threadItemSet.findCommentById( newCommentsSinceId );
|
||||||
if ( newCommentsSince && newCommentsSince instanceof CommentItem ) {
|
if ( newCommentsSince && newCommentsSince instanceof CommentItem ) {
|
||||||
|
@ -615,6 +634,17 @@ function highlightNewComments( threadItemSet, noScroll, newCommentIds, newCommen
|
||||||
}
|
}
|
||||||
document.getElementById( comments[ topmostComment ].id ).scrollIntoView();
|
document.getElementById( comments[ topmostComment ].id ).scrollIntoView();
|
||||||
}
|
}
|
||||||
|
} else if ( highlightsRequested ) {
|
||||||
|
missingTargetNotifPromise = mw.loader.using( 'mediawiki.notification' ).then( function () {
|
||||||
|
return mw.notification.notify(
|
||||||
|
mw.message(
|
||||||
|
highlightsRequestedSingle ?
|
||||||
|
'discussiontools-target-comment-missing' :
|
||||||
|
'discussiontools-target-comments-missing'
|
||||||
|
).parse(),
|
||||||
|
{ type: 'warn', autoHide: false }
|
||||||
|
);
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,6 +654,13 @@ function highlightNewComments( threadItemSet, noScroll, newCommentIds, newCommen
|
||||||
* @param {ThreadItemSet} threadItemSet
|
* @param {ThreadItemSet} threadItemSet
|
||||||
*/
|
*/
|
||||||
function clearHighlightTargetComment( threadItemSet ) {
|
function clearHighlightTargetComment( threadItemSet ) {
|
||||||
|
if ( missingTargetNotifPromise ) {
|
||||||
|
missingTargetNotifPromise.then( function ( notif ) {
|
||||||
|
notif.close();
|
||||||
|
} );
|
||||||
|
missingTargetNotifPromise = null;
|
||||||
|
}
|
||||||
|
|
||||||
var uri;
|
var uri;
|
||||||
try {
|
try {
|
||||||
uri = new mw.Uri( location.href );
|
uri = new mw.Uri( location.href );
|
||||||
|
|
Loading…
Reference in a new issue