Skip to content

WIP bugfix: hide private API when following guides/legacy links (#307) #339

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

Closed
wants to merge 1 commit into from
Closed

WIP bugfix: hide private API when following guides/legacy links (#307) #339

wants to merge 1 commit into from

Conversation

jenweber
Copy link
Contributor

@jenweber jenweber commented Sep 9, 2017

WIP don't merge.

Addresses #307

Based on conversation about hiding private API by default (#303), I think it makes sense that legacy urls should not show private api by default either.

Currently, links from the Guides redirect to showing all QPs (inherited, protected, private, deprecated), so new learners would see private API a lot. I fixed this by changing the legacy url processing.

@toddjordan
Copy link
Contributor

This would kill people's bookmarks

@jenweber
Copy link
Contributor Author

jenweber commented Sep 9, 2017

@toddjordan because people have bookmarks that include the QPs? I'll read this a little more closely and see if I can account for those.

@jenweber jenweber changed the title bugfix: hide private API when following guides/legacy links (#307) WIP bugfix: hide private API when following guides/legacy links (#307) Sep 9, 2017
@toddjordan
Copy link
Contributor

Yes people have bookmarks to private things. I guess it's a question of whether to support it

@jenweber
Copy link
Contributor Author

jenweber commented Sep 9, 2017

Broken links are the worst. I didn't really think it through all the way, just saw that legacy links get all the boxes checked and that the Guides are linking people to private APIs. I'll give it another shot. I think I can JavaScript my way through supporting both.

@toddjordan
Copy link
Contributor

Yeah. Agreed it's confusing linking from guides. We should def. convert thing guide links to the new URL structure

@jenweber
Copy link
Contributor Author

jenweber commented Sep 9, 2017

@toddjordan I think maybe this fixes it? Let me know your thoughts.

As of my latest commit:

  • if you have an old link that goes to something private, deprecated, or protected, you will see those QP in your redirect (and only those, so if you have a "private" QP and no others, you will only see only private API box checked)
  • if you have an old link with no QP specified, you will see only inherited by default (even if no inherited methods are available or you were linking to private API)

Examples:
Legacy link with hash & QP: http://localhost:4200/classes/Ember.Router.html?show=private#method_map
Redirects to: https://emberjs.com/api/ember/2.15.0/classes/Ember.Router/methods/map?anchor=map&show=private
Shows: only private API is checked.

Legacy hashed link without QP: http://localhost:4200/classes/Ember.Router.html?e#method_map
Redirects to: http://localhost:4200/ember/2.15.0/classes/Ember.Router/methods/map?anchor=map
Shows: Only inherited is checked via fallback to application wide defaults.

Legacy links without a hash or QP: http://localhost:4200/classes/String.html
Redirects to: http://localhost:4200/ember/2.15.0/classes/String
Shows: Only inherited is checked via fallback to application wide defaults. Since String has only private methods, none are shown by default.

Legacy links with QP and without a hash: http://localhost:4200/classes/String.html?show=private
Redirects to http://localhost:4200/ember/2.15.0/classes/String?show=private
Shows: Only private is checked.

Legacy private API links with private QP: http://localhost:4200/classes/Ember.Router.html?show=private#method__deserializeQueryParam
Redirects to http://localhost:4200/ember/2.15.0/classes/Ember.Router/methods/_deserializeQueryParam?anchor=_deserializeQueryParam&show=private
Shows: Only private is checked.

Legacy private API links missing QP: http://localhost:4200/classes/Ember.Router.html#method__deserializeQueryParam
Redirects to http://localhost:4200/ember/2.15.0/classes/Ember.Router/methods/_deserializeQueryParam?anchor=_deserializeQueryParam
Shows: Only inherited is checked via fallback to application wide defaults. Does not show specified private method!

@jenweber
Copy link
Contributor Author

jenweber commented Sep 9, 2017

@toddjordan I also experimentally tried to fix #340 so let me know if you want me to remove that change & squash the commits but I just undid that & squashed, since it seems like being on node v8 is important.

@jenweber
Copy link
Contributor Author

jenweber commented Sep 9, 2017

I just realized I am making the assumption that the old API site used QPs and they were named the same. Is that true?

@jenweber
Copy link
Contributor Author

I'm just going to close this and do something totally different after the links have settled. It's partially irrelevant from replacing all the links in 2.16 guides

@jenweber jenweber closed this Oct 23, 2017
Gaurav0 pushed a commit to Gaurav0/ember-api-docs that referenced this pull request Sep 16, 2019
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.

2 participants