Replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
@@ -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')
|
||||
}
|
||||
|
||||
|
||||
@@ -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}`)
|
||||
}
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user