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

Fix issue #158 #215

Merged
merged 2 commits into from
Apr 8, 2014
Merged

Fix issue #158 #215

merged 2 commits into from
Apr 8, 2014

Conversation

xiangcy
Copy link
Collaborator

@xiangcy xiangcy commented Oct 21, 2013

No description provided.

this.platform = options.platform;
}
},
render: function() {
this.$el.html(L.templates["pages/help"]());

if(this.platform) {
if(this.platform === "firefox" || this.platform === "chrome") {
Copy link
Member

Choose a reason for hiding this comment

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

Platform specific code and checks do not belong in the core code base.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So do you have any suggestions for handling the situation? For example, the additional help methods only appear in "firefox" version and "chrome" version, and the warning-persistence only appear in "webapp" version. Should I create the same file for every platform even if some of them are empty?

Copy link
Member

Choose a reason for hiding this comment

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

I think I see what you are doing here. No, we shouldn't create the same files for every platform. Instead, we should remove any this.platform checks (don't even pass the parameter) and simply see if L.templates["help"] is defined (although we should probably rename the template to platform-help). If it is defined, platform specific help text exists and should be rendered.

In general, code that checks for specific platforms should never go in the core code-base as they will inevitably lead to bugs (we'll forget to extend a check when implementing a new platform and things will break).

@karger
Copy link
Member

karger commented Oct 21, 2013

If these three commits are addressing separate issues, it's generally
better practice to submit three separate pull requests, so that each can
be pulled or rejected separately.

If these three commits are all addressing the same issue, it may be
useful (but not always) to "squash" these commits using git rebase (see
e.g.
http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html )
On 10/21/2013 7:37 PM, xiangcy wrote:


    You can merge this Pull Request by running

git pull https://github.com/xiangcy/listit loginpopup

Or view, comment on, or merge it at:

#215

    Commit Summary

@Stebalien
Copy link
Member

They are actually addressing 4 separate issues. 213b09a should be broken up into two commits. However, while nice, separate pull requests aren't really necessary; the request simply won't be merged until everything is fixed.

return this;
}
});

Copy link
Member

Choose a reason for hiding this comment

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

Exactly. However, the login state might change so you need to listen on changes to the registered attribute of L.server and update accordingly. Also, there's really no point in putting the if statement into the template, just put it outside the template and only render the warning if L.server.get('registered') returns false. This saves rendering an unused template.

@xiangcy
Copy link
Collaborator Author

xiangcy commented Mar 11, 2014

Delete all the platform-specific code, make the login popup listening to the registered state of the server, and rebase small commits into one big commit.

@Stebalien
Copy link
Member

I see 7 commits...

@xiangcy
Copy link
Collaborator Author

xiangcy commented Mar 11, 2014

That is because I already pushed some commits before and could not delete them remotely. Also when I rebase, I have to merge with the remote git repo. All the changes are in the commit xiangcy@d9735d1

@Stebalien
Copy link
Member

Logical Commits

Keep it to one commit per meaningful step. In this case, you need two commits, one for each issue. Preferably, these commits would be in two separate pull requests in this case that's up to you.

Basically, if you have:

  1. Fixes bug in 2
  2. Fixes x
  3. Fixes y

You should have:

  1. Fixes x (just include the bug fix here)
  2. Fixes y

However, you shouldn't have:

  1. Fixes y and y

Rebasing

I have to merge with the remote git repo.

You don't. When finalizing a pull request, do the following:

  1. Rebase off of haystack/master (the upstream master branch).
  2. TEST. Commits made to upstream/master might break your changes.
  3. Rework your commits into a meaningful steps using git rebase -i (git rebase -i haystack/master should let you interactivity rebase all commits made on-top-of upstream).
    4 Force push: git push -f. This will rewrite the remote history.

You don't really need to (and probably shouldn't) do this when simply revising a pull request (due to feedback) because it destroys history. However, when the pull request is ready to merge, I'll ask you to rebase and rework your commits so that the master history is clean.

L.views.MainPage = L.views.MainPage.extend({
initialize: function() {
OldMainPage.prototype.initialize.call(this);
//this.listenTo(L.server, 'change:registered', this.togglePopUpAlert());
Copy link
Member

Choose a reason for hiding this comment

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

Did you forget to uncomment this?

@xiangcy
Copy link
Collaborator Author

xiangcy commented Apr 1, 2014

Add a class "not-logged-in" for the main page, show the login warning when not logged in.

if(!L.server.get('registered')){
this.$el.addClass('not-logged-in');
} else {
this.$el.removeClass('not-logged-in');
Copy link
Member

Choose a reason for hiding this comment

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

Shorter:

this.$el.toggleClass('not-logged-in', !L.server.get('registered'))

@Stebalien
Copy link
Member

Nice! I'll merge it after you address my nitpick and rebase into two commits (one for each bug).

@xiangcy
Copy link
Collaborator Author

xiangcy commented Apr 1, 2014

Done. Fix the last thing and rebase into one commit only for bug 158.

@Stebalien
Copy link
Member

There are still two changes here: the platform specific help changes and the persistence warning. These should be in two separate commits.

@xiangcy
Copy link
Collaborator Author

xiangcy commented Apr 8, 2014

Decouple into two separate commits. Wait for merging to the main branch!

Stebalien added a commit that referenced this pull request Apr 8, 2014
@Stebalien Stebalien merged commit 63d5a08 into haystack:master Apr 8, 2014
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.

3 participants