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() #3669

Merged
merged 1 commit into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/ActivityEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default {
const subject = this.activity.subject_rich[0]
const parameters = JSON.parse(JSON.stringify(this.activity.subject_rich[1]))
if (parameters.after && typeof parameters.after.id === 'string' && parameters.after.id.startsWith('dt:')) {
const dateTime = parameters.after.id.substr(3)
const dateTime = parameters.after.id.slice(3)
parameters.after.name = moment(dateTime).format('L LTS')
}

Expand Down
4 changes: 2 additions & 2 deletions src/init-calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { generateUrl } from '@nextcloud/router'
subscribe('calendar:handle-todo-click', ({ calendarId, taskId }) => {
const deckAppPrefix = 'app-generated--deck--board-'
if (calendarId.startsWith(deckAppPrefix)) {
const board = calendarId.substr(deckAppPrefix.length)
const card = taskId.substr('card-'.length).replace('.ics', '')
const board = calendarId.slice(deckAppPrefix.length)
const card = taskId.slice('card-'.length).replace('.ics', '')
console.debug('[deck] Clicked task matches deck calendar pattern')
window.location = generateUrl(`apps/deck/#/board/${board}/card/${card}`)
}
Expand Down
2 changes: 1 addition & 1 deletion src/init-talk.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ window.addEventListener('DOMContentLoaded', () => {
icon: 'icon-deck',
async callback({ message: { message, actorDisplayName }, metadata: { name: conversationName, token: conversationToken } }) {
const shortenedMessageCandidate = message.replace(/^(.{255}[^\s]*).*/, '$1')
const shortenedMessage = shortenedMessageCandidate === '' ? message.substr(0, 255) : shortenedMessageCandidate
const shortenedMessage = shortenedMessageCandidate === '' ? message.slice(0, 255) : shortenedMessageCandidate
try {
await buildSelector(CardCreateDialog, {
props: {
Expand Down
4 changes: 2 additions & 2 deletions src/store/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default {

const filterOutQuotes = (q) => {
if (q[0] === '"' && q[q.length - 1] === '"') {
return q.substr(1, q.length - 2)
return q.slice(1, -1)
}
return q
}
Expand Down Expand Up @@ -153,7 +153,7 @@ export default {
const comparator = query[0] + (query[1] === '=' ? '=' : '')
const isValidComparator = ['<', '<=', '>', '>='].indexOf(comparator) !== -1
const parsedCardDate = moment(card.duedate)
const parsedDate = moment(query.substr(isValidComparator ? comparator.length : 0))
const parsedDate = moment(query.slice(isValidComparator ? comparator.length : 0))
switch (comparator) {
case '<':
hasMatch = hasMatch && parsedCardDate.isBefore(parsedDate)
Expand Down