Skip to content

Commit

Permalink
Append a Support tag if Gutenberg is default for new posts
Browse files Browse the repository at this point in the history
  • Loading branch information
hypest committed Feb 11, 2019
1 parent 15372fb commit 2b86c0f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,4 +498,5 @@ private object TicketFieldIds {

object ZendeskExtraTags {
const val connectingJetpack = "connecting_jetpack"
const val gutenbergIsDefault = "mobile_gutenberg_is_default"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ import org.wordpress.android.fluxc.model.SiteModel
import org.wordpress.android.fluxc.store.AccountStore
import org.wordpress.android.fluxc.store.SiteStore
import org.wordpress.android.support.SupportHelper
import org.wordpress.android.support.ZendeskExtraTags
import org.wordpress.android.support.ZendeskHelper
import org.wordpress.android.ui.ActivityId
import org.wordpress.android.ui.AppLogViewerActivity
import org.wordpress.android.ui.prefs.AppPrefs
import org.wordpress.android.util.LocaleManager
import java.util.ArrayList
import java.util.Collections
import javax.inject.Inject

class HelpActivity : AppCompatActivity() {
Expand Down Expand Up @@ -177,9 +179,27 @@ class HelpActivity : AppCompatActivity() {
if (selectedSite != null) {
intent.putExtra(WordPress.SITE, selectedSite)
}
if (extraSupportTags != null && !extraSupportTags.isEmpty()) {
intent.putStringArrayListExtra(HelpActivity.EXTRA_TAGS_KEY, extraSupportTags as ArrayList<String>?)

val tagsList: ArrayList<String>? = if (AppPrefs.isGutenbergDefaultForNewPosts()) {
// construct a mutable list to add the Gutenberg related extra tag
val list = ArrayList<String>()

// add the provided list of tags if any
extraSupportTags?.let {
list.addAll(extraSupportTags)
}

// Append the "mobile_gutenberg_is_default" tag if gutenberg is set to default for new posts
list.add(ZendeskExtraTags.gutenbergIsDefault)
list // "return" the list
} else {
extraSupportTags as ArrayList<String>?
}

if (tagsList != null && !tagsList.isEmpty()) {
intent.putStringArrayListExtra(HelpActivity.EXTRA_TAGS_KEY, tagsList)
}

return intent
}
}
Expand Down

0 comments on commit 2b86c0f

Please sign in to comment.