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
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default defineConfig([
},
},
rules: {
'no-console': 'warn',
'no-console': 'error',
'no-unused-vars': 'warn',

// 'jsdoc/no-undefined-types': 'error',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Composer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ export default {
},

aliases(newAliases) {
console.debug('aliases changed')
logger.debug('aliases changed')
if (this.selectedAlias === NO_ALIAS_SET) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Envelope.vue
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ export default {

hasMultipleRecipients() {
if (!this.account) {
console.error('account is undefined', {
logger.error('account is undefined', {
accountId: this.data.accountId,
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/MenuEnvelope.vue
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export default {

hasMultipleRecipients() {
if (!this.account) {
console.error('account is undefined', {
logger.error('account is undefined', {
accountId: this.envelope.accountId,
})
}
Expand Down
1 change: 0 additions & 1 deletion src/components/MessageAttachments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export default {
},
mounted() {
console.log(this.attachments)
let prevTop = null
this.visible = 0
this.$nextTick(function() {
Expand Down
2 changes: 0 additions & 2 deletions src/components/MessagePlainTextBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ export default {
},

signatureSummary() {
console.info(this.signature.match(regFirstParagraph))

return this.signatureSummaryAndBody.summary
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/NavigationAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,14 @@ export default {

onMenuToggle(open) {
if (open && this.account.quotaPercentage !== null) {
console.debug('accounts menu opened, fetching quota')
logger.debug('accounts menu opened, fetching quota')
this.fetchQuota()
}
},

async fetchQuota() {
const quota = await fetchQuota(this.account.id)
console.debug('quota fetched', {
logger.debug('quota fetched', {
quota,
})

Expand Down
2 changes: 1 addition & 1 deletion src/components/NavigationMailbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ export default {
this.renameInput = false
} catch (error) {
showInfo(t('mail', 'An error occurred, unable to rename the mailbox.'))
console.error(error)
logger.error('could not rename mailbox', { error })
} finally {
this.showSaving = false
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/NewMessageModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export default {
const sizePreference = this.mainStore.getPreference('modalSize')
this.largerModal = sizePreference === 'large'
} catch (error) {
console.error('Error getting modal size preference', error)
logger.error('Error getting modal size preference', { error })
}
},

Expand All @@ -298,7 +298,7 @@ export default {
value: this.largerModal ? 'large' : 'normal',
})
} catch (error) {
console.error('Failed to save preference', error)
logger.error('Failed to save preference', { error })
}
},

Expand Down Expand Up @@ -623,7 +623,7 @@ export default {
e.returnValue = true
this.mainStore.showMessageComposerMutation()
} else {
console.info('No unsaved changes. See you!')
logger.debug('no unsaved changes, closing')
}
},

Expand Down
7 changes: 4 additions & 3 deletions src/components/RecipientBubble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ import IconClose from 'vue-material-design-icons/CloseOutline.vue'
import IconDetails from 'vue-material-design-icons/InformationOutline.vue'
import IconAdd from 'vue-material-design-icons/Plus.vue'
import IconReply from 'vue-material-design-icons/ReplyOutline.vue'
import logger from '../logger.js'
import { fetchAvatarUrlMemoized } from '../service/AvatarService.js'
import { addToContact, autoCompleteByName, findMatches, newContact } from '../service/ContactIntegrationService.js'

Expand Down Expand Up @@ -215,7 +216,7 @@ export default {
try {
this.avatarUrl = await fetchAvatarUrlMemoized(this.email)
} catch (error) {
console.debug('no avatar for ' + this.email, {
logger.debug('no avatar for ' + this.email, {
error,
})
}
Expand Down Expand Up @@ -258,11 +259,11 @@ export default {
onClickAddToContact() {
if (this.selection === ContactSelectionStateEnum.new) {
if (this.newContactName !== '') {
newContact(this.newContactName.trim(), this.email).then((res) => console.debug('ContactIntegration', res))
newContact(this.newContactName.trim(), this.email).then((res) => logger.debug('ContactIntegration', { res }))
}
} else if (this.selection === ContactSelectionStateEnum.existing) {
if (this.selectedContact) {
addToContact(this.selectedContact.id, this.email).then((res) => console.debug('ContactIntegration', res))
addToContact(this.selectedContact.id, this.email).then((res) => logger.debug('ContactIntegration', { res }))
}
}
},
Expand Down
5 changes: 3 additions & 2 deletions src/components/TagItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import { NcActionInput as ActionInput, NcActions as Actions, NcActionText as Act
import { mapStores } from 'pinia'
import IconEdit from 'vue-material-design-icons/PencilOutline.vue'
import DeleteIcon from 'vue-material-design-icons/TrashCanOutline.vue'
import logger from '../logger.js'
import useMainStore from '../store/mainStore.js'
import { translateTagDisplayName } from '../util/tag.js'

Expand Down Expand Up @@ -131,7 +132,7 @@ export default {
this.showSaving = false
} catch (error) {
showInfo(t('mail', 'An error occurred, unable to rename the tag.'))
console.error(error)
logger.error('could not rename tag', { error })
this.showSaving = true
}
},
Expand Down Expand Up @@ -159,7 +160,7 @@ export default {
this.showSaving = false
} catch (error) {
showInfo(t('mail', 'An error occurred, unable to rename the tag.'))
console.error(error)
logger.error('could not rename tag', { error })
this.renameTagLabel = false
this.renameTagInput = false
this.showSaving = true
Expand Down
5 changes: 3 additions & 2 deletions src/components/TagModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import IconAdd from 'vue-material-design-icons/Plus.vue'
import IconTag from 'vue-material-design-icons/TagOutline.vue'
import DeleteTagModal from './DeleteTagModal.vue'
import TagItem from './TagItem.vue'
import logger from '../logger.js'
import useMainStore from '../store/mainStore.js'
import { hiddenTags } from './tags.js'

Expand Down Expand Up @@ -179,7 +180,7 @@ export default {
color: randomColor(displayName),
})
} catch (error) {
console.debug(error)
logger.error('could not create tag', { error })
showError(this.t('mail', 'An error occurred, unable to create the tag.'))
} finally {
this.showSaving = false
Expand Down Expand Up @@ -223,7 +224,7 @@ export default {
this.showSaving = false
} catch (error) {
showInfo(t('mail', 'An error occurred, unable to rename the tag.'))
console.error(error)
logger.error('could not rename tag', { error })
this.renameTagLabel = false
this.renameTagInput = false
this.showSaving = true
Expand Down
2 changes: 1 addition & 1 deletion src/components/TextEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ export default {
this.editorInstance.editing.view.focus()
})
.catch((error) => {
console.debug('Smart picker promise rejected:', error)
logger.debug('Smart picker promise rejected', { error })
})
}
if (eventData.marker === '@') {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Thread.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default {
threadSubject() {
const thread = this.thread
if (thread.length === 0) {
console.warn('thread is empty')
logger.warn('thread is empty')
return ''
}
return thread[0].subject || this.t('mail', 'No subject')
Expand Down Expand Up @@ -188,10 +188,10 @@ export default {
return
}
if (!this.expandedThreads.includes(threadId)) {
console.debug(`expand thread ${threadId}`)
logger.debug(`expand thread ${threadId}`)
this.expandedThreads.push(threadId)
} else {
console.debug(`collapse thread ${threadId}`)
logger.debug(`collapse thread ${threadId}`)
this.expandedThreads = this.expandedThreads.filter((t) => t !== threadId)
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/ThreadEnvelope.vue
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ export default {
hasMultipleRecipients() {
if (!this.account) {
console.error('account is undefined', {
logger.error('account is undefined', {
accountId: this.envelope.accountId,
})
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/TranslationModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ import { mapState } from 'pinia'
import WarningIcon from 'vue-material-design-icons/AlertOctagonOutline.vue'
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
import ContentCopy from 'vue-material-design-icons/ContentCopy.vue'
import logger from '../logger.js'
import { translateText } from '../service/translationService.js'
import useMainStore from '../store/mainStore.js'

Expand Down Expand Up @@ -175,7 +176,7 @@ export default {
const response = await translateText(this.message.trim(), this.selectedFrom.value, this.selectedTo.value)
this.translatedMessage = response
} catch (error) {
console.error(error)
logger.error('could not translate message', { error })
showError(error.response?.data?.ocs?.data?.message ?? t('mail', 'The message could not be translated'))
} finally {
this.isLoading = false
Expand Down
3 changes: 2 additions & 1 deletion src/components/itinerary/CalendarImport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import moment from '@nextcloud/moment'
import { NcActionButton as ActionButton, NcActions as Actions, NcLoadingIcon as IconLoading } from '@nextcloud/vue'
import ical from 'ical.js'
import IconAdd from 'vue-material-design-icons/Plus.vue'
import logger from '../../logger.js'

export default {
name: 'CalendarImport',
Expand Down Expand Up @@ -63,7 +64,7 @@ export default {
calendar.loading = true

this.handler(calendar)
.catch(console.error.bind(this))
.catch((error) => logger.error('could not import calendar event', { error }))
.then(() => {
calendar.loading = false
})
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/MailboxTranslator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import { translate as t } from '@nextcloud/l10n'
import logger from '../logger.js'

function translateSpecial(mailbox) {
if (mailbox.specialUse.includes('all')) {
Expand Down Expand Up @@ -54,7 +55,7 @@ export function translate(mailbox) {
try {
return translateSpecial(mailbox)
} catch (e) {
console.error('could not translate special mailbox', e)
logger.error('could not translate special mailbox', { error: e })
}
}
return mailbox.displayName
Expand Down
3 changes: 2 additions & 1 deletion src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { loadState } from '@nextcloud/initial-state'
import logger from './logger.js'
import { fixAccountId } from './service/AccountService.js'
import { fetchAvailableLanguages } from './service/translationService.js'
import useMainStore from './store/mainStore.js'
import useOutboxStore from './store/outboxStore.js'

export default function initAfterAppCreation() {
console.debug('Init after app creation')
logger.debug('Init after app creation')
const mainStore = useMainStore()

const preferences = loadState('mail', 'preferences', [])
Expand Down
5 changes: 3 additions & 2 deletions src/service/FileSharingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import axios from '@nextcloud/axios'
import { showError } from '@nextcloud/dialogs'
import { generateOcsUrl } from '@nextcloud/router'
import logger from '../logger.js'

/**
* Makes a share link for a given file or directory.
Expand All @@ -33,11 +34,11 @@ async function shareFile(path, token) {
&& error.response.data.ocs.meta
&& error.response.data.ocs.meta.message
) {
console.error(`Error while sharing file: ${error.response.data.ocs.meta.message || 'Unknown error'}`)
logger.error(`Error while sharing file: ${error.response.data.ocs.meta.message || 'Unknown error'}`, { error })
showError(error.response.data.ocs.meta.message)
throw error
} else {
console.error('Error while sharing file: Unknown error')
logger.error('Error while sharing file: Unknown error', { error })
showError(t('mail', 'Error while sharing file'))
throw error
}
Expand Down
3 changes: 2 additions & 1 deletion src/service/translationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
import logger from '../logger.js'
import useMainStore from '../store/mainStore.js'

async function fetchAvailableLanguages() {
Expand All @@ -23,7 +24,7 @@ async function fetchAvailableLanguages() {
mainStore.translationInputLanguages = inputLanguages
mainStore.translationOutputLanguages = outputLanguages
} catch (e) {
console.error('Failed to fetch available languages', e)
logger.error('Failed to fetch available languages', { error: e })
}
}

Expand Down
Loading
Loading