Skip to content

Commit d5a2c09

Browse files
committed
Fixed linting issues
Signe-off-by: pallavibakale <pallavibakale09@gmail.com>
1 parent 7c9b5c4 commit d5a2c09

1 file changed

Lines changed: 50 additions & 75 deletions

File tree

src/views/Contacts.vue

Lines changed: 50 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
<template>
77
<Content :app-name="appName">
88
<!-- new-contact-button + navigation + settings -->
9-
<RootNavigation :loading="loadingContacts || loadingCircles">
9+
<RootNavigation
10+
:loading="loadingContacts || loadingCircles">
1011
<div class="import-and-new-contact-buttons">
11-
<SettingsImportContacts
12-
v-if="
13-
!loadingContacts && isEmptyGroup && !isChartView && !isCirclesView
14-
" />
12+
<SettingsImportContacts v-if="!loadingContacts && isEmptyGroup && !isChartView && !isCirclesView" />
1513
<!-- new-contact-button -->
1614
<NcButton
1715
v-if="!loadingContacts"
@@ -22,21 +20,21 @@
2220
<template #icon>
2321
<IconAdd :size="20" />
2422
</template>
25-
{{
26-
isCirclesView
27-
? t('contacts', 'Add member')
28-
: t('contacts', 'New contact')
29-
}}
23+
{{ isCirclesView ? t('contacts', 'Add member') : t('contacts', 'New contact') }}
3024
</NcButton>
3125
</div>
3226
</RootNavigation>
3327

3428
<!-- Main content: circle, chart or contacts -->
35-
<UserGroupContent v-if="selectedUserGroup" :loding="loadingCircles" />
29+
<UserGroupContent
30+
v-if="selectedUserGroup"
31+
:loding="loadingCircles" />
3632
<CircleContent
3733
v-if="selectedCircle || selectedUserGroup"
3834
:loading="loadingCircles" />
39-
<ChartContent v-else-if="selectedChart" :contacts-list="contacts" />
35+
<ChartContent
36+
v-else-if="selectedChart"
37+
:contacts-list="contacts" />
4038
<ContactsContent
4139
v-else
4240
:contacts-list="contactsList"
@@ -77,12 +75,7 @@ import ContactsPicker from '../components/EntityPicker/ContactsPicker.vue'
7775
import ImportView from './Processing/ImportView.vue'
7876
import IsMobileMixin from '../mixins/IsMobileMixin.ts'
7977
import RouterMixin from '../mixins/RouterMixin.js'
80-
import {
81-
GROUP_ALL_CONTACTS,
82-
GROUP_NO_GROUP_CONTACTS,
83-
ROUTE_CIRCLE,
84-
ROUTE_USER_GROUP,
85-
} from '../models/constants.ts'
78+
import { GROUP_ALL_CONTACTS, GROUP_NO_GROUP_CONTACTS, ROUTE_CIRCLE, ROUTE_USER_GROUP } from '../models/constants.ts'
8679
import Contact from '../models/contact.js'
8780
import rfcProps from '../models/rfcProps.js'
8881
import client from '../services/cdav.js'
@@ -107,7 +100,10 @@ export default {
107100
SettingsImportContacts,
108101
},
109102
110-
mixins: [IsMobileMixin, RouterMixin],
103+
mixins: [
104+
IsMobileMixin,
105+
RouterMixin,
106+
],
111107
112108
data() {
113109
return {
@@ -195,10 +191,7 @@ export default {
195191
return this.sortedContacts
196192
} else if (this.selectedGroup === GROUP_NO_GROUP_CONTACTS) {
197193
return this.ungroupedContacts.map((contact) => this.sortedContacts.find((item) => item.key === contact.key))
198-
} else if (
199-
this.selectedGroup === ROUTE_CIRCLE
200-
|| this.selectedGroup === ROUTE_USER_GROUP
201-
) {
194+
} else if (this.selectedGroup === ROUTE_CIRCLE || this.selectedGroup === ROUTE_USER_GROUP) {
202195
return []
203196
}
204197
const group = this.groups.filter((group) => group.name === this.selectedGroup)[0]
@@ -209,15 +202,11 @@ export default {
209202
},
210203
211204
isCirclesView() {
212-
return (
213-
this.selectedGroup === ROUTE_CIRCLE
214-
|| this.selectedGroup === ROUTE_USER_GROUP
215-
)
205+
return this.selectedGroup === ROUTE_CIRCLE || this.selectedGroup === ROUTE_USER_GROUP
216206
},
217207
218208
ungroupedContacts() {
219-
return this.sortedContacts.filter((contact) => this.contacts[contact.key].groups
220-
&& this.contacts[contact.key].groups.length === 0)
209+
return this.sortedContacts.filter((contact) => this.contacts[contact.key].groups && this.contacts[contact.key].groups.length === 0)
221210
},
222211
},
223212
@@ -251,24 +240,22 @@ export default {
251240
this.logger.debug('Connected to dav!', { client })
252241
const principalsStore = usePrincipalsStore()
253242
principalsStore.setCurrentUserPrincipal(client)
254-
this.$store.dispatch('getAddressbooks').then((addressbooks) => {
255-
const writeableAddressBooks = addressbooks.filter((addressbook) => !addressbook.readOnly)
256-
257-
// No writeable addressbooks? Create a new one!
258-
if (writeableAddressBooks.length === 0) {
259-
this.$store
260-
.dispatch('appendAddressbook', {
261-
displayName: t('contacts', 'Contacts'),
262-
})
263-
.then(() => {
264-
this.fetchContacts()
265-
})
243+
this.$store.dispatch('getAddressbooks')
244+
.then((addressbooks) => {
245+
const writeableAddressBooks = addressbooks.filter((addressbook) => !addressbook.readOnly)
246+
247+
// No writeable addressbooks? Create a new one!
248+
if (writeableAddressBooks.length === 0) {
249+
this.$store.dispatch('appendAddressbook', { displayName: t('contacts', 'Contacts') })
250+
.then(() => {
251+
this.fetchContacts()
252+
})
266253
// else, let's get those contacts!
267-
} else {
268-
this.fetchContacts()
269-
}
270-
})
271-
// check local storage for orderKey
254+
} else {
255+
this.fetchContacts()
256+
}
257+
})
258+
// check local storage for orderKey
272259
if (localStorage.getItem('orderKey')) {
273260
// run setOrder mutation with local storage key
274261
this.$store.commit('setOrder', localStorage.getItem('orderKey'))
@@ -278,8 +265,7 @@ export default {
278265
// Get circles if enabled
279266
if (isCirclesEnabled) {
280267
const userGroupStore = useUserGroupStore()
281-
this.$store
282-
.dispatch('getCircles')
268+
this.$store.dispatch('getCircles')
283269
.then(userGroupStore.getUserGroups(getCurrentUser().uid))
284270
.then(() => {
285271
this.loadingCircles = false
@@ -300,9 +286,7 @@ export default {
300286
VERSION:4.0
301287
PRODID:-//Nextcloud Contacts v${appVersion}
302288
END:VCARD
303-
`
304-
.trim()
305-
.replace(/\t/gm, ''),
289+
`.trim().replace(/\t/gm, ''),
306290
this.defaultAddressbook,
307291
)
308292
@@ -320,10 +304,7 @@ export default {
320304
defaultValue = [...defaultValue]
321305
}
322306
// add default field
323-
const property = contact.vCard.addPropertyWithValue(
324-
name,
325-
defaultValue,
326-
)
307+
const property = contact.vCard.addPropertyWithValue(name, defaultValue)
327308
// add default type
328309
if (defaultData.type) {
329310
property.setParameter('type', defaultData.type)
@@ -377,14 +358,13 @@ export default {
377358
fetchContacts() {
378359
// wait for all addressbooks to have fetch their contacts
379360
// don't filter disabled at this point, because sum of contacts per address book is shown
380-
Promise.all(this.addressbooks.map((addressbook) => {
381-
if (!addressbook.enabled) {
382-
return Promise.resolve()
383-
}
384-
return this.$store.dispatch('getContactsFromAddressBook', {
385-
addressbook,
386-
})
387-
})).then(() => {
361+
Promise.all(this.addressbooks
362+
.map((addressbook) => {
363+
if (!addressbook.enabled) {
364+
return Promise.resolve()
365+
}
366+
return this.$store.dispatch('getContactsFromAddressBook', { addressbook })
367+
})).then(() => {
388368
this.loadingContacts = false
389369
if (!this.isMobile && !this.selectedChart) {
390370
this.selectFirstContactIfNone()
@@ -402,8 +382,7 @@ export default {
402382
return
403383
}
404384
405-
const inList
406-
= this.contactsList.findIndex((contact) => contact.key === this.selectedContact) > -1
385+
const inList = this.contactsList.findIndex((contact) => contact.key === this.selectedContact) > -1
407386
if (!this.selectedContact || !inList) {
408387
// Unknown contact
409388
if (this.selectedContact && !inList) {
@@ -417,18 +396,14 @@ export default {
417396
}
418397
419398
// Unknown group
420-
if (
421-
!this.selectedCircle
399+
if (!this.selectedCircle
422400
&& !this.selectedUserGroup
423401
&& !this.groups.find((group) => group.name === this.selectedGroup)
424402
&& GROUP_ALL_CONTACTS !== this.selectedGroup
425403
&& GROUP_NO_GROUP_CONTACTS !== this.selectedGroup
426404
&& ROUTE_CIRCLE !== this.selectedGroup
427-
&& ROUTE_USER_GROUP !== this.selectedGroup
428-
) {
429-
showError(t('contacts', 'Group {group} not found', {
430-
group: this.selectedGroup,
431-
}))
405+
&& ROUTE_USER_GROUP !== this.selectedGroup) {
406+
showError(t('contacts', 'Group {group} not found', { group: this.selectedGroup }))
432407
console.error('Group not found', this.selectedGroup)
433408
434409
this.$router.push({
@@ -461,8 +436,8 @@ export default {
461436

462437
<style lang="scss" scoped>
463438
.import-and-new-contact-buttons {
464-
display: flex;
465-
flex-direction: column;
466-
gap: 4px;
439+
display: flex;
440+
flex-direction: column;
441+
gap: 4px;
467442
}
468443
</style>

0 commit comments

Comments
 (0)