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

LevelSources are now shared with R links on the client #16777

Merged
merged 6 commits into from Aug 7, 2017

Conversation

caleybrock
Copy link
Contributor

@caleybrock caleybrock commented Aug 2, 2017

This PR replaces /c/ links with /r/ links in the UI of the share dialog.

The changes to ActivitiesControllerTest are consistent with the existing hackiness in that file. The entire file needs to be rewritten to be readable. Being outside the scope of this PR, we are not doing so here.

MANUAL TESTING (LOCALLY):

  1. Login.
  2. Go to localhost-studio.code.org/s/mc/stage/1/level/14
  3. Hit Run and Finish.
  4. Share link will be an '/r/' link.
  5. Share link works.
  6. Delete user.
  7. Share link no longer valid.
  8. If not logged in when creating an /r/ link, the link will always be valid.

Paired with @ashercodeorg

Copy link
Contributor

@aoby aoby left a comment

Choose a reason for hiding this comment

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

LGTM, w a couple style suggestions

@@ -175,7 +175,7 @@ def milestone_response(options)
end

if options[:level_source].try(:id)
response[:level_source] = level_source_url(id: options[:level_source].id)
response[:level_source] = obfuscated_level_source_url(level_source_id_and_user_id: options[:level_source].obfuscate_level_source_id(current_user.try(:id)))
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is well wider than our 120 column styleguide limit. Please break this line up, e.g.

response[:level_source] = obfuscated_level_source_url(
  level_source_id_and_user_id: options[:level_source].obfuscate_level_source_id(current_user.try(:id))
)

Copy link
Contributor

Choose a reason for hiding this comment

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

Done.

# signed in.
def current_user_id
session['warden.user.user.key'].try(:first).try(:first)
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not put it in test_helper now?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because I'd rather keep the PR changes self-contained. As part of moving it to test_helper, I'd want to convert other tests to make use of it. Another PR.

@@ -409,7 +422,8 @@ def _test_logged_in_milestone_should_save_gallery_when_passing_an_impressive_lev

assert_response :success

expected_response = build_expected_response(level_source: "http://test.host/c/#{assigns(:level_source).id}")
obfuscated_level_source_url = assigns(:level_source).obfuscate_level_source_id(current_user_id)
expected_response = build_expected_response(level_source: "http://test.host/r/#{obfuscated_level_source_url}")
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like these 2 lines are repeated a lot. Would it make sense to consolidate them into a method?

Copy link
Contributor

Choose a reason for hiding this comment

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

It would. That said, I'm calling that part of the "rewritten to be readable" in the PR summary, that I'm hoping to punt on as part of this PR. Expect a follow-up...

@ashercodeorg
Copy link
Contributor

@poorvasingal last call to change the URL structure... Let us know if we are good on /r/, if you want more time for discussions, or if there is something else we should be using.

@caleybrock
Copy link
Contributor Author

Poorva and Alice say use /r/ final answer.

@caleybrock caleybrock merged commit 0ab1003 into staging Aug 7, 2017
@caleybrock caleybrock deleted the r-links-on-client branch August 7, 2017 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants