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

Auto-init repo on license, .gitignore select #12202

Merged
merged 8 commits into from
Jul 23, 2020

Conversation

cipherboy
Copy link
Contributor

When a .gitignore or LICENSE file is added, the user is expecting the
repository to be auto-initialized. However, nothing sets the auto_init
value, so it remains at its default. We should set it to checked when
a .gitignore or LICENSE file is added, matching user expectations. If
the user clears .gitignore or LICENSE, it will leave repository creation
enabled. If the user changes the value again, it will re-check the box
if the user has since de-checked it. This behavior is at least
consistent.

Resolves: #11071

Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>

web_src/js/index.js Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 9, 2020
@silverwind
Copy link
Member

Please don't use globals like that. You can check for the new repo page like this and run your code if the selector matches:

if (document.querySelector('.repository.new.repo')) {
  // your code here 
}

When a .gitignore or LICENSE file is added, the user is expecting the
repository to be auto-initialized. However, nothing sets the auto_init
value, so it remains at its default. We should set it to checked when
a .gitignore or LICENSE file is added, matching user expectations. If
the user clears .gitignore or LICENSE, it will leave repository creation
enabled. If the user changes the value again, it will re-check the box
if the user has since de-checked it. This behavior is at least
consistent.

Resolves: go-gitea#11071

Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>
@cipherboy cipherboy force-pushed the detect-auto-init-repository branch from 9419339 to 63a0256 Compare July 9, 2020 23:00
@cipherboy
Copy link
Contributor Author

Please don't use globals like that.

Ah gotcha. Probably should migrate the old globals to the newer style sometime...

@silverwind Thanks! Updated. Hopefully the jquery style is to your liking. :)

@lafriks lafriks added the topic/ui Change the appearance of the Gitea UI label Jul 12, 2020
@lafriks lafriks added this to the 1.13.0 milestone Jul 12, 2020
web_src/js/index.js Outdated Show resolved Hide resolved
Co-authored-by: silverwind <me@silverwind.io>
@cipherboy
Copy link
Contributor Author

Sorry, was out of internet range. Updated!

web_src/js/index.js Outdated Show resolved Hide resolved
web_src/js/index.js Outdated Show resolved Hide resolved
web_src/js/index.js Outdated Show resolved Hide resolved
cipherboy and others added 2 commits July 21, 2020 20:01
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lauris BH <lauris@nix.lv>
web_src/js/index.js Outdated Show resolved Hide resolved
Co-authored-by: Lauris BH <lauris@nix.lv>
@lafriks
Copy link
Member

lafriks commented Jul 22, 2020

Lint complains about ident

web_src/js/index.js Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 22, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 23, 2020
@lafriks lafriks merged commit 4497db9 into go-gitea:master Jul 23, 2020
Comment on lines +761 to +762
const gitignores = $('input[name="gitignores"]').prop('checked');
const license = $('input[name="license"]').prop('checked');
Copy link
Member

Choose a reason for hiding this comment

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

I just realized that these are not checkboxes :D These lines should have been:

      const gitignores = $('input[name="gitignores"]').val() !== '';
      const license = $('input[name="license"]').val() !== '';

Copy link
Member

Choose a reason for hiding this comment

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

Right I missed it too. .val() should be sufficient and possible more future-proof just in case the value of a empty select box ever changes to null or undefined.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for PR. I don't think jQuery would return null or undefined but not sure. Have not used jQuery for quite some time already 😂

Copy link
Member

Choose a reason for hiding this comment

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

Nothing to do with jQuery, but I guess DOM <input> value is probably guaranteed to be a string (even for type=number 😆).

@lafriks
Copy link
Member

lafriks commented Jul 23, 2020

I don't know how I messed up that, sorry :)

silverwind added a commit to silverwind/gitea that referenced this pull request Jul 23, 2020
techknowlogick pushed a commit that referenced this pull request Jul 23, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

license does not automatically initialise repository
4 participants