Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a link for contacting support in error messages #6364

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions client/lib/upgrades/actions/purchases.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import debugFactory from 'debug';
import i18n from 'i18n-calypso';
import React from 'react';

/**
* Internal dependencies
Expand All @@ -12,12 +13,17 @@ import Dispatcher from 'dispatcher';
import olark from 'lib/olark';
import purchasesAssembler from 'lib/purchases/assembler';
import wp from 'lib/wp';
import { CALYPSO_CONTACT } from 'lib/url/support';

const debug = debugFactory( 'calypso:upgrades:actions:purchases' ),
wpcom = wp.undocumented();

const PURCHASES_FETCH_ERROR_MESSAGE = i18n.translate( 'There was an error retrieving purchases.' ),
PURCHASE_REMOVE_ERROR_MESSAGE = i18n.translate( 'There was an error removing the purchase.' );
const PURCHASES_FETCH_ERROR_MESSAGE = i18n.translate( 'There was an error retrieving purchases. Please try again later or {{a}}contact support{{/a}}.', {
components: { a: <a href={ CALYPSO_CONTACT } /> }
} ),
PURCHASE_REMOVE_ERROR_MESSAGE = i18n.translate( 'There was an error removing the purchase. Please try again later or {{a}}contact support{{/a}}.', {
components: { a: <a href={ CALYPSO_CONTACT } /> }
} );

function cancelPurchase( purchaseId, onComplete ) {
wpcom.cancelPurchase( purchaseId, ( error, data ) => {
Expand Down Expand Up @@ -53,7 +59,9 @@ function cancelPrivateRegistration( purchaseId, onComplete ) {
Dispatcher.handleServerAction( {
type: ActionTypes.PRIVACY_PROTECTION_CANCEL_FAILED,
purchaseId,
error: error.message || i18n.translate( 'There was a problem canceling this private registration. Please try again later or contact support.' )
error: i18n.translate( 'There was a problem canceling this private registration. Please try again later or {{a}}contact support{{/a}}.', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the rationale behind ignoring error.message?

Copy link
Contributor Author

@yurynix yurynix Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drewblaisdell It's broken - contains <a /> without a href...
and also I believe it's a bit confusing, I don't really sure it's good to tell the user what actually the problem is, I feel that a more general error is more appropriate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the error message? If it's broken we should probably fix it.

I don't necessarily agree, unless the error message is about a technical error that users won't be able to understand. Otherwise I think we should display the message returned by the API, or update it if it doesn't do the job. Note a custom message is also useful for support when they are contacted by users and need to investigate a problem.

components: { a: <a href={ CALYPSO_CONTACT } /> }
} )
} );
}

Expand Down Expand Up @@ -88,7 +96,9 @@ function deleteStoredCard( card, onComplete ) {
} else {
Dispatcher.handleServerAction( {
type: ActionTypes.STORED_CARDS_DELETE_FAILED,
error: error.message || i18n.translate( 'There was a problem deleting the stored card. Please try again later or contact support.' )
error: i18n.translate( 'There was a problem deleting the stored card. Please try again later or {{a}}contact support{{/a}}.', {
components: { a: <a href={ CALYPSO_CONTACT } /> }
} )
} );
}

Expand Down Expand Up @@ -136,7 +146,9 @@ function fetchStoredCards() {
} else if ( error ) {
Dispatcher.handleServerAction( {
type: ActionTypes.STORED_CARDS_FETCH_FAILED,
error: error.message || i18n.translate( 'There was a problem retrieving stored cards. Please try again later or contact support.' )
error: i18n.translate( 'There was a problem retrieving stored cards. Please try again later or {{a}}contact support{{/a}}.', {
components: { a: <a href={ CALYPSO_CONTACT } /> }
} )
} );
}
} );
Expand Down