Skip to content
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
6 changes: 3 additions & 3 deletions src/components/AdminSettings/TurnServer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ export default {
const types = candidates.map((cand) => cand.type)

this.testing = false
if (types.indexOf('relay') === -1) {
this.testingError = true
} else {
if (types.includes('relay')) {
this.testingSuccess = true
} else {
this.testingError = true
}

setTimeout(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/LeftSidebar/LeftSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ export default {
if (this.searchText !== '') {
const lowerSearchText = this.searchText.toLowerCase()
conversations = conversations.filter(conversation =>
conversation.displayName.toLowerCase().indexOf(lowerSearchText) !== -1
|| conversation.name.toLowerCase().indexOf(lowerSearchText) !== -1
conversation.displayName.toLowerCase().includes(lowerSearchText)
|| conversation.name.toLowerCase().includes(lowerSearchText)
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/MediaDevicesSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default {
props: {
kind: {
validator(value) {
return ['audioinput', 'videoinput'].indexOf(value) !== -1
return ['audioinput', 'videoinput'].includes(value)
},
required: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ export default {

methods: {
userHasReacted(reaction) {
return this.reactionsSelf && this.reactionsSelf.indexOf(reaction) !== -1
return this.reactionsSelf && this.reactionsSelf.includes(reaction)
},

lastReadMessageVisibilityChanged(isVisible) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export default {

// Making sure that the click is outside the MessageButtonsBar
handleClickOutside(event) {
if (event.composedPath().indexOf(this.$el) !== -1) {
if (event.composedPath().includes(this.$el)) {
return
}
this.closeReactionsMenu()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export default {
},

currentUserIsModerator() {
return [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR].indexOf(this.participantType) !== -1
return [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR].includes(this.participantType)
},

canEndPoll() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/NewMessageForm/TemplatePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default {
* @return {string}
*/
nameWithoutExt() {
return this.basename.indexOf('.') > -1 ? this.basename.split('.').slice(0, -1).join('.') : this.basename
return this.basename.includes('.') ? this.basename.split('.').slice(0, -1).join('.') : this.basename
},

id() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ export default {
if (this.searchText !== '') {
const lowerSearchText = this.searchText.toLowerCase()
participants = participants.filter(participant => {
return participant.displayName.toLowerCase().indexOf(lowerSearchText) !== -1
return participant.displayName.toLowerCase().includes(lowerSearchText)
|| (participant.actorType !== 'guests'
&& participant.actorId.toLowerCase().indexOf(lowerSearchText) !== -1)
&& participant.actorId.toLowerCase().includes(lowerSearchText))
})
}

Expand All @@ -98,7 +98,7 @@ export default {

currentParticipantIsModerator() {
const moderatorTypes = [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR]
return this.currentParticipant && moderatorTypes.indexOf(this.currentParticipant.participantType) !== -1
return this.currentParticipant && moderatorTypes.includes(this.currentParticipant.participantType)
},
},

Expand Down Expand Up @@ -215,8 +215,8 @@ export default {
}

const moderatorTypes = [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR]
const moderator1 = moderatorTypes.indexOf(participant1.participantType) !== -1
const moderator2 = moderatorTypes.indexOf(participant2.participantType) !== -1
const moderator1 = moderatorTypes.includes(participant1.participantType)
const moderator2 = moderatorTypes.includes(participant2.participantType)

if (moderator1 !== moderator2) {
return moderator1 ? -1 : 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ describe('Participant.vue', () => {
const wrapper = mountParticipant(participant)
let actionTexts = wrapper.findAllComponents(NcActionText)
actionTexts = actionTexts.filter((actionText) => {
return actionText.props('title').indexOf('PIN') >= 0
return actionText.props('title').includes('PIN')
})

expect(actionTexts.exists()).toBe(true)
Expand All @@ -727,7 +727,7 @@ describe('Participant.vue', () => {
const wrapper = mountParticipant(participant)
let actionTexts = wrapper.findAllComponents(NcActionText)
actionTexts = actionTexts.filter((actionText) => {
return actionText.props('title').indexOf('PIN') >= 0
return actionText.props('title').includes('PIN')
})

expect(actionTexts.exists()).toBe(false)
Expand All @@ -739,7 +739,7 @@ describe('Participant.vue', () => {
const wrapper = mountParticipant(participant)
let actionTexts = wrapper.findAllComponents(NcActionText)
actionTexts = actionTexts.filter((actionText) => {
return actionText.props('title').indexOf('PIN') >= 0
return actionText.props('title').includes('PIN')
})

expect(actionTexts.exists()).toBe(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ export default {
},

isSelf() {
return this.sessionIds.length && this.sessionIds.indexOf(this.currentParticipant.sessionId) >= 0
return this.sessionIds.length && this.sessionIds.includes(this.currentParticipant.sessionId)
},

selfIsModerator() {
Expand All @@ -530,7 +530,7 @@ export default {
},

isGuest() {
return [PARTICIPANT.TYPE.GUEST, PARTICIPANT.TYPE.GUEST_MODERATOR].indexOf(this.participantType) !== -1
return [PARTICIPANT.TYPE.GUEST, PARTICIPANT.TYPE.GUEST_MODERATOR].includes(this.participantType)
},

isGroup() {
Expand All @@ -551,7 +551,7 @@ export default {

showModeratorLabel() {
return this.isModerator
&& [CONVERSATION.TYPE.ONE_TO_ONE, CONVERSATION.TYPE.ONE_TO_ONE_FORMER, CONVERSATION.TYPE.CHANGELOG].indexOf(this.conversation.type) === -1
&& ![CONVERSATION.TYPE.ONE_TO_ONE, CONVERSATION.TYPE.ONE_TO_ONE_FORMER, CONVERSATION.TYPE.CHANGELOG].includes(this.conversation.type)
},

canBeModerated() {
Expand All @@ -563,7 +563,7 @@ export default {

canBeDemoted() {
return this.canBeModerated
&& [PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR].indexOf(this.participantType) !== -1
&& [PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR].includes(this.participantType)
},

canBePromoted() {
Expand Down Expand Up @@ -635,7 +635,7 @@ export default {
},

participantTypeIsModerator(participantType) {
return [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR].indexOf(participantType) !== -1
return [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR].includes(participantType)
},

async promoteToModerator() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default {
* Whether the participant is a guest or not.
*/
isGuest() {
return [PARTICIPANT.TYPE.GUEST, PARTICIPANT.TYPE.GUEST_MODERATOR].indexOf(this.participant.participantType) !== -1
return [PARTICIPANT.TYPE.GUEST, PARTICIPANT.TYPE.GUEST_MODERATOR].includes(this.participant.participantType)
},

/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/TopBar/CallButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export default {

methods: {
isParticipantTypeModerator(participantType) {
return [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR].indexOf(participantType) !== -1
return [PARTICIPANT.TYPE.OWNER, PARTICIPANT.TYPE.MODERATOR, PARTICIPANT.TYPE.GUEST_MODERATOR].includes(participantType)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for myself @Antreesy:
method is not used in project since for a while, can be deleted

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And there is also some indexOf in the project
Feel free to make another PR =)
image

},

/**
Expand Down
4 changes: 2 additions & 2 deletions src/mixins/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ export const devices = {
// insecure contexts; in older browser versions it is, but getting
// the user media fails with "NotAllowedError".
const isInsecureContext = 'isSecureContext' in window && !window.isSecureContext
const isInsecureContextAccordingToErrorMessage = this.audioStreamError.message && this.audioStreamError.message.indexOf('Only secure origins') !== -1
const isInsecureContextAccordingToErrorMessage = this.audioStreamError.message && this.audioStreamError.message.includes('Only secure origins')
if ((this.audioStreamError.name === 'NotSupportedError' && isInsecureContext)
|| (this.audioStreamError.name === 'NotAllowedError' && isInsecureContextAccordingToErrorMessage)) {
return t('spreed', 'Access to microphone is only possible with HTTPS')
Expand All @@ -412,7 +412,7 @@ export const devices = {
// insecure contexts; in older browser versions it is, but getting
// the user media fails with "NotAllowedError".
const isInsecureContext = 'isSecureContext' in window && !window.isSecureContext
const isInsecureContextAccordingToErrorMessage = this.videoStreamError.message && this.videoStreamError.message.indexOf('Only secure origins') !== -1
const isInsecureContextAccordingToErrorMessage = this.videoStreamError.message && this.videoStreamError.message.includes('Only secure origins')
if ((this.videoStreamError.name === 'NotSupportedError' && isInsecureContext)
|| (this.videoStreamError.name === 'NotAllowedError' && isInsecureContextAccordingToErrorMessage)) {
return t('spreed', 'Access to camera is only possible with HTTPS')
Expand Down
3 changes: 1 addition & 2 deletions src/utils/media/pipeline/TrackToStream.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ describe('TrackToStream', () => {
this._tracks = []

this.addTrack = jest.fn((track) => {
const index = this._tracks.indexOf(track)
if (index >= 0) {
if (this._tracks.includes(track)) {
console.error('Tried to add again track already added to stream')
return
}
Expand Down
10 changes: 4 additions & 6 deletions src/utils/webrtc/webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ let sendCurrentStateWithRepetitionTimeout = null
* @param {Array} b Object to find all items in
*/
function arrayDiff(a, b) {
return a.filter(function(i) {
return b.indexOf(i) < 0
})
return a.filter(i => !b.includes(i))
}

/**
Expand Down Expand Up @@ -290,8 +288,8 @@ function usersChanged(signaling, newUsers, disconnectedSessionIds) {

// TODO(fancycode): Adjust property name of internal PHP backend to be all lowercase.
const sessionId = user.sessionId || user.sessionid
if (!sessionId || sessionId === currentSessionId || previousUsersInRoom.indexOf(sessionId) !== -1) {
if (sessionId === currentSessionId && previousUsersInRoom.indexOf(sessionId) !== -1) {
if (!sessionId || sessionId === currentSessionId || previousUsersInRoom.includes(sessionId)) {
if (sessionId === currentSessionId && previousUsersInRoom.includes(sessionId)) {
Sounds.playJoin(true, newUsers.length === 1)
}
return
Expand Down Expand Up @@ -1562,7 +1560,7 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local
if ((error.name === 'NotSupportedError'
&& webrtc.capabilities.supportRTCPeerConnection)
|| (error.name === 'NotAllowedError'
&& error.message && error.message.indexOf('Only secure origins') !== -1)) {
&& error.message && error.message.includes('Only secure origins'))) {
message = t('spreed', 'Access to microphone & camera is only possible with HTTPS')
message += ': ' + t('spreed', 'Please move your setup to HTTPS')
} else if (error.name === 'NotAllowedError') {
Expand Down