-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[Frontend] Make localstorage read ssh or https correctly #11483
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
[Frontend] Make localstorage read ssh or https correctly #11483
Conversation
If not login there is only a "https" button, This commit fix the "https" button hasn't blue border.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have effectively you changed the defaults to ssh by resetting it to that value when user selects HTTPS? Also, there's already code present to save the value on click, I don't see why you would want to set it on initialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afraid I have to remove my approval with new changes
Assume a situation. If you sign in and select "ssh" option. then you log out and view the repo's homepage. Your previous selection will be overwrite to "https". |
|
If you click the "https" your default selection will change. The "setitem sentence" will only do when the your selection is "ssh". |
The setitem under this code |
You are right, it does work. The check should be moved to |
This comment has been minimized.
This comment has been minimized.
I meant something like this: Index: web_src/js/index.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- web_src/js/index.js (revision 695a181b01d50235b80aa6c7077924a0708e5d9c)
+++ web_src/js/index.js (date 1589821225642)
@@ -1109,8 +1109,10 @@
$('.clone-url').text($(this).data('link'));
$('#repo-clone-url').val($(this).data('link'));
$(this).addClass('blue');
- $('#repo-clone-ssh').removeClass('blue');
- localStorage.setItem('repo-clone-protocol', 'https');
+ if ($('#repo-clone-ssh').length > 0) {
+ $('#repo-clone-ssh').removeClass('blue');
+ localStorage.setItem('repo-clone-protocol', 'https');
+ }
});
$('#repo-clone-url').on('click', function () {
$(this).select();
@@ -2440,7 +2442,6 @@
$('#repo-clone-ssh').trigger('click');
} else {
$('#repo-clone-https').trigger('click');
- localStorage.setItem('repo-clone-protocol', 'ssh');
}
break;
default: |
I just thought of this. I will change this. |
It is ready for review. And thanks for the advice from @CirnoT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let @CirnoT lgtm count
@L0veSunshine pleace send backport :) |
I am very sorry, i don't know how to do that. |
* Make localstorage read ssh or https correctly * Update index.js If not login there is only a "https" button, This commit fix the "https" button hasn't blue border. * Keep user selected whether or not to log in * Update index.js
if your local gitea repo hast your fork as remote named origin: git remote add upstream https://github.com/go-gitea/gitea
git fetch --all
git checkout -f upstream/release/v1.12 -b backport_11483
git cherry-pick eb8abffcc1be777d38a416a030a6e4f42b06ac25
git push -u origin backport_11483 and then make a pull from your fork (branch backport_11483) to the gitea repo branch release/v1.12 witch result in: ceers :) this is of cours only one way to do it ... |
Thank you for the tutorial. I will learn. Also thank to your help. |
* Make localstorage read ssh or https correctly * Update index.js If not login there is only a "https" button, This commit fix the "https" button hasn't blue border. * Keep user selected whether or not to log in * Update index.js Co-authored-by: L0veSunshine <xuan199651@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Make localstorage read ssh or https correctly * Update index.js If not login there is only a "https" button, This commit fix the "https" button hasn't blue border. * Keep user selected whether or not to log in * Update index.js
The localstorage has stored the user's option of repo's link type, but it don't read correctly.
This pr fix it : when you select the ssh type link, all repo links you enter later are displayed in ssh form.
The ui about this pr is here:
