Gergő Tisza has uploaded a new change for review. https://gerrit.wikimedia.org/r/247969
Change subject: Add some error details to bug report ...................................................................... Add some error details to bug report Bug: T111112 Change-Id: I1c3a31ddaefdfec0d86b80891671316741e53b0c --- M extension.json M i18n/en.json M i18n/qqq.json M resources/mmv/ui/mmv.ui.canvas.js M resources/mmv/ui/mmv.ui.metadataPanel.js 5 files changed, 36 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer refs/changes/69/247969/1 diff --git a/extension.json b/extension.json index 0e3fe39..8a6db0b 100644 --- a/extension.json +++ b/extension.json @@ -144,6 +144,7 @@ "multimediaviewer-thumbnail-error-description", "multimediaviewer-thumbnail-error-retry", "multimediaviewer-report-issue-url", + "multimediaviewer-thumbnail-error-report", "multimediaviewer-download-link", "multimediaviewer-reuse-link", "multimediaviewer-options-tooltip", diff --git a/i18n/en.json b/i18n/en.json index adfe8f4..2a0c7c7 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -19,9 +19,10 @@ "multimediaviewer-multiple-authors-combine": "$1 and $2", "multimediaviewer-metadata-error": "Could not load image details (error: $1)", "multimediaviewer-thumbnail-error": "Sorry, the file cannot be displayed", - "multimediaviewer-thumbnail-error-description": "There seems to be a technical issue. You can $1 or [{{int:multimediaviewer-report-issue-url}} report the issue] if it persists. Error: $2", + "multimediaviewer-thumbnail-error-description": "There seems to be a technical issue. You can $1 or $3 if it persists. Error: $2", "multimediaviewer-thumbnail-error-retry": "retry", - "multimediaviewer-report-issue-url": "https://phabricator.wikimedia.org/maniphest/task/create/?projects=PHID-PROJ-cabyqp5sf4hyvauln3sq", + "multimediaviewer-thumbnail-error-report": "report the issue", + "multimediaviewer-report-issue-url": "https://phabricator.wikimedia.org/maniphest/task/create/?projects=PHID-PROJ-cabyqp5sf4hyvauln3sq&description=$1", "multimediaviewer-license-cc-by-1.0": "CC BY 1.0", "multimediaviewer-license-cc-sa-1.0": "CC SA 1.0", "multimediaviewer-license-cc-by-sa-1.0": "CC BY-SA 1.0", diff --git a/i18n/qqq.json b/i18n/qqq.json index 5e15d34..6358342 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -30,6 +30,7 @@ "multimediaviewer-thumbnail-error-description": "Text shown when the image could not be loaded. Follows {{msg-mw|multimediaviewer-thumbnail-error}}. Parameters:\n* $1 - \"retry\" link (see {{msg-wm|multimediaviewer-thumbnail-error-retry}})\n* $2 - the error message (not localized)\nSee also:\n* {{msg-mw|multimediaviewer-thumbnail-error}}", "multimediaviewer-thumbnail-error-retry": "Used as a part of {{msg-mw|multimediaviewer-thumbnail-error-description}} (as a link text).\n{{Identical|Retry}}", "multimediaviewer-report-issue-url": "{{ignored}}URL to the report issue website", + "multimediaviewer-thumbnail-error-report": "Used as a part of {{msg-mw|multimediaviewer-thumbnail-error-description}} (as a link text).", "multimediaviewer-license-cc-by-1.0": "Very short label for the Creative Commons Attribution license, version 1.0, used in a link to the file information page that has more licensing information.\n{{Identical|CC BY}}", "multimediaviewer-license-cc-sa-1.0": "Very short label for the Creative Commons ShareAlike license, version 1.0, used in a link to the file information page that has more licensing information.", "multimediaviewer-license-cc-by-sa-1.0": "Very short label for the Creative Commons Attribution ShareAlike license, version 1.0, used in a link to the file information page that has more licensing information.\n{{Identical|CC BY-SA}}", diff --git a/resources/mmv/ui/mmv.ui.canvas.js b/resources/mmv/ui/mmv.ui.canvas.js index fef3c7d..8b965cf 100644 --- a/resources/mmv/ui/mmv.ui.canvas.js +++ b/resources/mmv/ui/mmv.ui.canvas.js @@ -341,6 +341,32 @@ * @param {string} error error message */ C.showError = function ( error ) { + var errorDetails, description, errorUri, retryLink, reportLink + canvasDimensions = this.getDimensions(), + thumbnailDimensions = this.getCurrentImageWidths(), + htmlUtils = new mw.mmv.HtmlUtils(); + + errorDetails = { + error: error, + URL: location.href, + "user agent": navigator.userAgent, + "screen size": screen.width + 'x' + screen.height, + "canvas size": canvasDimensions.width + 'x' + canvasDimensions.height, + "thumbnail size": thumbnailDimensions.width + 'x' + thumbnailDimensions.height + }; + description = '**Details of the error are atteched to the report, which will be publicly ' + + 'viewable. If you are not comfortable with that, you can edit the report below ' + + 'and remove all data you don\'t want to share.**\n\n\nError details:\n\n'; + $.each( errorDetails, function ( key, value ) { + description += key + ': ' + value + '\n'; + } ); + errorUri = mw.message( 'multimediaviewer-report-issue-url', encodeURIComponent( description ) ).text(); + + retryLink = $( '<a>' ).addClass( 'mw-mmv-retry-link' ).text( + mw.message( 'multimediaviewer-thumbnail-error-retry' ).text() ); + reportLink = $( '<a>' ).attr( 'href', errorUri ).text( + mw.message( 'multimediaviewer-thumbnail-error-report' ).text() ); + this.$imageDiv.empty() .addClass( 'error' ) .append( @@ -351,9 +377,10 @@ ).append( $( '<div>' ).addClass( 'mw-mmv-error-description' ).append( mw.message( 'multimediaviewer-thumbnail-error-description', - $( '<a>' ).addClass( 'mw-mmv-retry-link' ).text( - mw.message( 'multimediaviewer-thumbnail-error-retry' ).text() ), - error ).parse() + htmlUtils.jqueryToHtml( retryLink ), + error, + htmlUtils.jqueryToHtml( reportLink ) + ).text() ) ) ); diff --git a/resources/mmv/ui/mmv.ui.metadataPanel.js b/resources/mmv/ui/mmv.ui.metadataPanel.js index fc8d001..cbcd915 100644 --- a/resources/mmv/ui/mmv.ui.metadataPanel.js +++ b/resources/mmv/ui/mmv.ui.metadataPanel.js @@ -460,7 +460,7 @@ MPP.setUserPageLink = function ( repoData, username, gender ) { var userpage = 'User:' + username, articlePath = repoData.getArticlePath(), - userlink = articlePath.replace( '$1', userpage ); + userlink = articlePath ? articlePath.replace( '$1', userpage ) : undefined; this.$username .text( -- To view, visit https://gerrit.wikimedia.org/r/247969 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1c3a31ddaefdfec0d86b80891671316741e53b0c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MultimediaViewer Gerrit-Branch: master Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits