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
expose pairing_channel_id, use with getPathName() for pairing URL #18141
Conversation
apps/src/StudioApp.js
Outdated
@@ -509,6 +509,11 @@ StudioApp.prototype.alertIfCompletedWhilePairing = function (config) { | |||
{msg.pairingNavigatorLink()} | |||
</a> | |||
} | |||
{config.level.pairingChannelId && | |||
<a href={window.dashboard.project.getPathName('view', config.level.pairingChannelId)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now import project (rather than relying on window.dashboard), so I think you can just do project.getPathName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* @returns {string} Url to the specified action. | ||
* @throws {Error} If this type of project does not have a standalone app. | ||
*/ | ||
getPathName(action) { | ||
var pathName = this.appToProjectUrl() + '/' + this.getCurrentId(); | ||
getPathName(action, projectId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with ES6 we can express this as getPathName(action, projectId = this.getCurrentId)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
var pathName = this.appToProjectUrl() + '/' + this.getCurrentId(); | ||
getPathName(action, projectId) { | ||
projectId = projectId || this.getCurrentId(); | ||
var pathName = this.appToProjectUrl() + '/' + projectId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let instead of var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -307,7 +307,7 @@ def user_progress_for_stage | |||
elsif level.channel_backed? | |||
@level = level | |||
recent_channel = safe_get_channel_for(level, recent_user) if recent_user | |||
response[:pairingAttempt] = send("#{level.game.app}_project_view_projects_url".to_sym, channel_id: recent_channel) rescue nil if recent_channel | |||
response[:pairingChannelId] = recent_channel if recent_channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach of sending a channel Id instead 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few small nits, but otherwise looks good. i like the new approach :)
getStandaloneApp()
- seecode-dot-org/apps/src/code-studio/initApp/project.js
Line 528 in 23a245f
pairing_attempt
URL for channel-backed levels, we instead generate apairing_channel_id
and move the URL generation to the client-side where we already have access to the special client-side code