Skip to content

Commit

Permalink
Merge pull request #3448 from CommanderRoot/refactor/rm-deprecated-su…
Browse files Browse the repository at this point in the history
…bstr

refactor: replace deprecated String.prototype.substr()
  • Loading branch information
David Christofas authored Apr 11, 2022
2 parents 251e5d2 + 4227769 commit b291cca
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/enhancement-replace-deprecated-substr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Replace deprecated String.prototype.substr()

We've replaced all occurrences of the deprecated String.prototype.substr()
function with String.prototype.slice() which works similarly but isn't
deprecated.

https://github.com/owncloud/ocis/pull/3448
2 changes: 1 addition & 1 deletion idp/ui/src/containers/Login/Chooseaccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function Chooseaccount({ loading, errors, classes, hello, history, dispatch }) {
className={classes.accountListItem}
disabled={!!loading}
onClick={(event) => logon(event)}
><ListItemAvatar><Avatar>{username.substr(0, 1)}</Avatar></ListItemAvatar>
><ListItemAvatar><Avatar>{username.slice(0, 1)}</Avatar></ListItemAvatar>
<ListItemText className="oc-light" primary={username} />
</ListItem>
<ListItem
Expand Down
2 changes: 1 addition & 1 deletion idp/ui_config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const envPublicUrl = process.env.PUBLIC_URL;
function ensureSlash(inputPath, needsSlash) {
const hasSlash = inputPath.endsWith('/');
if (hasSlash && !needsSlash) {
return inputPath.substr(0, inputPath.length - 1);
return inputPath.slice(0, -1);
} else if (!hasSlash && needsSlash) {
return `${inputPath}/`;
} else {
Expand Down
2 changes: 1 addition & 1 deletion settings/ui/components/SettingsBundle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default {
methods: {
...mapActions('Settings', ['saveValue']),
getSettingComponent (setting) {
return 'Setting' + setting.type[0].toUpperCase() + setting.type.substr(1)
return 'Setting' + setting.type[0].toUpperCase() + setting.type.slice(1)
},
getValue (setting) {
return this.getSettingsValue({ settingId: setting.id })
Expand Down

0 comments on commit b291cca

Please sign in to comment.