MCPcopy Create free account
hub / github.com/codecombat/codecombat / checkHackstackRedirect

Method checkHackstackRedirect

app/views/play/CampaignView.js:2604–2616  ·  view source on GitHub ↗

* Check if this campaign should redirect to HackStack and return redirect info * @returns {Object|null} Redirect info object or null if no redirect needed

()

Source from the content-addressed store, hash-verified

2602 * @returns {Object|null} Redirect info object or null if no redirect needed
2603 */
2604 checkHackstackRedirect () {
2605 try {
2606 const isHackstackType = this.campaign?.get('type') === 'hackstack' || this.campaign?.get('isHackstackCampaign')
2607 const alreadyOnAIPath = /^\/ai\/play\//.test(location.pathname)
2608 if (isHackstackType && !alreadyOnAIPath && !this.editorMode) {
2609 const slug = this.campaign.get('slug') || this.terrain
2610 return { slug, dest: `/ai/play/${slug}` }
2611 }
2612 } catch (e) {
2613 // no-op
2614 }
2615 return null
2616 }
2617
2618 /**
2619 * Execute HackStack redirect after all loading is complete

Callers 1

constructorMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected