Skip to content

Commit

Permalink
Merge pull request #21453 from wordpress-mobile/issue/21449-a8c-feedb…
Browse files Browse the repository at this point in the history
…ack-form

Enable Zendesk tickets from Automatticians
  • Loading branch information
nbradbury authored Nov 15, 2024
2 parents e9fd284 + 7d77222 commit 24699b0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
import org.wordpress.android.ui.posts.PostsListActivity;
import org.wordpress.android.ui.posts.RemotePreviewLogicHelper.RemotePreviewType;
import org.wordpress.android.ui.prefs.AccountSettingsActivity;
import org.wordpress.android.ui.prefs.AppPrefs;
import org.wordpress.android.ui.prefs.AppSettingsActivity;
import org.wordpress.android.ui.prefs.BlogPreferencesActivity;
import org.wordpress.android.ui.prefs.MyProfileActivity;
Expand Down Expand Up @@ -128,7 +127,6 @@
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.T;
import org.wordpress.android.util.ToastUtils;
import org.wordpress.android.util.ToastUtils.Duration;
import org.wordpress.android.util.UriWrapper;
import org.wordpress.android.util.UrlUtils;
import org.wordpress.android.util.WPActivityUtils;
Expand Down Expand Up @@ -1313,7 +1311,6 @@ public static void viewHelp(@NonNull Context context, @NonNull Origin origin, @N
}

public static void viewFeedbackForm(@NonNull Context context) {
warnIfIdentityA8C(context);
AnalyticsTracker.track(Stat.APP_REVIEWS_FEEDBACK_SCREEN_OPENED);
Intent intent = new Intent(context, FeedbackFormActivity.class);
context.startActivity(intent);
Expand All @@ -1324,17 +1321,6 @@ public static void viewZendeskTickets(@NonNull Context context,
viewHelpInNewStack(context, Origin.ZENDESK_NOTIFICATION, selectedSite, null);
}

/**
* Warn A8C users that they can't create Zendesk tickets
*/
@NonNull
public static void warnIfIdentityA8C(@NonNull Context context) {
String supportEmail = AppPrefs.getSupportEmail();
if (supportEmail.contains("@automattic.com") || supportEmail.contains("@a8c.com")) {
ToastUtils.showToast(context, R.string.support_warn_if_user_a8c, Duration.LONG);
}
}

public static void viewSSLCerts(Context context, String certificateString) {
Intent intent = new Intent(context, SSLCertsViewActivity.class);
intent.putExtra(SSLCertsViewActivity.CERT_DETAILS_KEYS, certificateString.replaceAll("\n", "<br/>"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ class HelpActivity : LocaleAwareActivity() {
}

private fun launchSupportWidget() {
ActivityLauncher.warnIfIdentityA8C(this)
val intent = SupportWebViewActivity.createIntent(
this,
originFromExtras,
Expand All @@ -184,7 +183,6 @@ class HelpActivity : LocaleAwareActivity() {
}

private fun createNewZendeskTicket() {
ActivityLauncher.warnIfIdentityA8C(this)
zendeskHelper.createNewTicket(
this,
originFromExtras,
Expand All @@ -199,7 +197,6 @@ class HelpActivity : LocaleAwareActivity() {
}

private fun showZendeskTickets() {
ActivityLauncher.warnIfIdentityA8C(this)
zendeskHelper.showAllTickets(
this,
originFromExtras,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,15 @@ public static void setSupportEmail(String email) {
}

public static String getSupportEmail() {
return getString(DeletablePrefKey.SUPPORT_EMAIL);
String email = getString(DeletablePrefKey.SUPPORT_EMAIL);
// Zendesk can't create support tickets for Automattic email addresses
// with a staff member role (admin, agent, etc.), so insert an "+testing"
// alias into the email to make it work
if ((email.contains("@automattic.com") || email.contains("@a8c.com")) && !email.contains("+")) {
return email.replace("@", "+testing@");
} else {
return email;
}
}

public static void removeSupportEmail() {
Expand Down
3 changes: 1 addition & 2 deletions WordPress/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1146,8 +1146,7 @@
<string name="feedback_form_attachment_already_added">Attachment already added</string>
<string name="feedback_form_unable_to_create_tempfile">Unable to create temporary file</string>
<string name="feedback_form_add_attachments">Add attachments</string>
<string name="feedback_form_note">If you need support, please get in touch using the \"Help &amp; Support\" screen</string>
<string name="support_warn_if_user_a8c">Automattic email accounts can\'t submit or view support tickets</string>
<string name="feedback_form_note">If you need support, please get in touch using the \"Contact Support\" screen</string>
<string name="media_pager_remove_item_content_description">Remove item %1$d</string>

<!-- activity log -->
Expand Down

0 comments on commit 24699b0

Please sign in to comment.