Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Show all contributors in the AboutDialog#7666

Merged
TomMalbran merged 6 commits intoadobe:masterfrom
marcelgerber:all-contributors
May 10, 2014
Merged

Show all contributors in the AboutDialog#7666
TomMalbran merged 6 commits intoadobe:masterfrom
marcelgerber:all-contributors

Conversation

@marcelgerber
Copy link
Copy Markdown
Contributor

This is the second fix for #7614, which is respecting the pagination of the GitHub API correctly.

Comment thread src/help/HelpCommandHandlers.js Outdated
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is there a better method than using async: false?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am thinking that maybe we could just get the total pages and then use Async.doInParallel, using an array of pages numbers as the first argument and loadContributorsPage(page) (that returns the ajax/getJSON) as the second parameter.
Another solution is to implement it similar to how Async.doInParallel is done.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But there's no easy way for getting the total pages, right? The only way I know would be to load the first page synchronouzly and then read the header. It wouldn't improve anything.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can do a head ajax request and read the content before doing anything else:
$.ajax({type: "HEAD", url, url}).done(function (data) { ...do the rest... })

@njx
Copy link
Copy Markdown

njx commented Apr 28, 2014

@TomMalbran would you mind finishing the review on this one? thx

Comment thread src/brackets.config.json Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What do you think about using https://api.github.com/repos/adobe/brackets/contributors?per_page=100&page={0}?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Jup, that's better.

Comment thread src/help/HelpCommandHandlers.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't needed anymore. Same with data 2 lines down

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. It's a pity our JSLint doesn't catch them lines automatically.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A newer version of JSLint would catch it. Even after we move to JSHint, we would be able to catch it. But not now that we have a really old version of JSLint.

@TomMalbran
Copy link
Copy Markdown
Contributor

@SAplayer This looks great, just a few more minor things, and we are probably done.

@marcelgerber
Copy link
Copy Markdown
Contributor Author

@TomMalbran Ready for another (hopefully the last) review.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we also show some kind of error after the loaded contributors. We would show the pictures that we get and a line saying something like And more (but we're having trouble loading that data right now).

If we add that text to the contributors template we need to add a new line at the bottom like: {{#error}}<p>{{Strings.ABOUT_MORE_CONTRIBUTORS}}</p>{{/error}}, when rendering the template pass an object like: {contributors: allContributors, error: error, Strings: Strings}, and change in the template {{#.}} and {{/.}} with {{#contributors}} and {{/contributors}}.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't believe we need this (at least for now), it shouldn't be a common case.
We are loading 3 pages (yes, we got > 200 contributors now), which is done in less than a second.
The only things that could cause such an issue is a very bad internet connection or a fail in the GH API. While the second one is very unlikely, the first one probably won't happen within a second.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, this is a really uncommon case. I guess we can keep it like that.

@TomMalbran
Copy link
Copy Markdown
Contributor

@SAplayer Just one more idea to add to the dialog.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wouldn't do it. This request changes the URL and the code should rely on the paging enabled. If it is not, then it should break (and it's OK). We should probably add a testcase for that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am ok either way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did this code because I don't know which URL is used by Edge Code, or even if they use this feature at all.
But you're right, we can probably just remove it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I actually added the url to the config file since we were adding all the urls there, but not because it might be changed by Edge Code.

Saying that, I don't know if Edge Code actually changes it. So we might need to ask the team about it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just looked at it again and saw that the current implemention is not relying on pagination enabled, but it would be if we removed this particular line.
I guess it's better the way it is, so I won't change it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants