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

Replace deprecated String.prototype.substr() with String.prototype.slice() #18796

Merged
merged 2 commits into from
Feb 18, 2022
Merged

Replace deprecated String.prototype.substr() with String.prototype.slice() #18796

merged 2 commits into from
Feb 18, 2022

Conversation

CommanderRoot
Copy link
Contributor

String.prototype.substr() is deprecated so we replace it with the String.prototype.slice() method which works similarily but isn't deprecated.
substr() probably isn't going away anytime soon but it doesn't hurt to replace it as the change isn't difficult at all.

@lunny
Copy link
Member

lunny commented Feb 17, 2022

web_src/fomantic/build/semantic.js should not be changed directly?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 17, 2022
@silverwind
Copy link
Member

silverwind commented Feb 17, 2022

web_src/fomantic/build/semantic.js is vendored/generated third-party code, please revert the changes there and possibly file a PR against https://github.com/fomantic/Fomantic-UI.

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@397d2ac). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #18796   +/-   ##
=======================================
  Coverage        ?   46.58%           
=======================================
  Files           ?      853           
  Lines           ?   122463           
  Branches        ?        0           
=======================================
  Hits            ?    57050           
  Misses          ?    58526           
  Partials        ?     6887           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 397d2ac...0ff7985. Read the comment docs.

@CommanderRoot
Copy link
Contributor Author

CommanderRoot commented Feb 17, 2022

My apologies. I ignored the files in the vendor folder but didn't check if the other files are possibly vendored as well. I have now changed the commit to exclude the mentioned file

…ice()

String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with the slice() method which works similarily but isn't deprecated.

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
@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 Feb 17, 2022
@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 Feb 17, 2022
@silverwind silverwind added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Feb 17, 2022
@silverwind
Copy link
Member

CI failure is unrelated, maybe #18793 will resolve it.

@lunny
Copy link
Member

lunny commented Feb 18, 2022

make L-G-T-M work

@lunny lunny merged commit 1ab88da into go-gitea:main Feb 18, 2022
@CommanderRoot CommanderRoot deleted the rm-deprecated-js-substr branch February 18, 2022 07:46
zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 18, 2022
* giteaofficial/main:
  Fix ldap loginname (go-gitea#18789)
  Replace deprecated String.prototype.substr() with String.prototype.slice() (go-gitea#18796)
  Fix problem when self-assign notification (go-gitea#18797)
  Move editorconfig-checker to lint-backend and remove JS wrapper (go-gitea#18793)
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
…ice() (go-gitea#18796)

String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with the slice() method which works similarily but isn't deprecated.

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@wxiaoguang wxiaoguang added this to the 1.17.0 milestone Mar 29, 2022
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
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. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants