Merge pull request #3448 from CommanderRoot/refactor/rm-deprecated-substr

refactor: replace deprecated String.prototype.substr()
This commit is contained in:
David Christofas
2022-04-11 16:27:47 +02:00
committed by GitHub
4 changed files with 10 additions and 3 deletions
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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 {
+1 -1
View File
@@ -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 })