Skip to content

Commit ceaaf12

Browse files
Resul AvanResul Avan
Resul Avan
authored and
Resul Avan
committed
autocomplete fix
1 parent 1d75157 commit ceaaf12

File tree

5 files changed

+29
-27
lines changed

5 files changed

+29
-27
lines changed

functions/src/warmUpScheduledFunction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { HandlerConfig } from 'handlers-module'
44
import { ApiConfig } from 'types-module'
55

66
export const warmUpScheduledFunction = pubsub
7-
.schedule('0 */15 * * *')
7+
.schedule('*/15 * * * *')
88
.onRun((context) => {
99
syncRequest('GET', HandlerConfig.getWebsiteUrl())
1010
syncRequest('GET', `${HandlerConfig.getWebsiteUrl()}${ApiConfig.healthy}`)

src/components/form/SetEmailPasswordForm.vue

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
{{ $t('provider.linkPasswordProvider.passwordForm.title') }}
55
</h3>
66
<p class="has-text-centered has-margin-bottom-15">
7-
{{ email ?
8-
$t('provider.linkPasswordProvider.passwordForm.description',{email}) :
9-
$t('provider.linkPasswordProvider.passwordForm.descriptionNoEmail') }}
7+
{{ description }}
108
</p>
119
<div class="box">
12-
1310
<ValidationObserver v-slot="{ passes }" tag="form">
1411
<FieldWithValue
1512
v-if="!!email"
@@ -90,6 +87,11 @@ export default class SetPasswordForm extends Vue {
9087
9188
confirmedPassword = '';
9289
90+
get description () {
91+
return this.email ? this.$t('provider.linkPasswordProvider.passwordForm.description', { email: this.email })
92+
: this.$t('provider.linkPasswordProvider.passwordForm.descriptionNoEmail')
93+
}
94+
9395
submit () {
9496
this.confirmCredentials(this.credentials)
9597
}

src/components/navbar/SearchBar.vue

+17-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<template>
22
<b-field label-position="on-border" expanded>
33
<b-autocomplete
4-
v-model="query"
54
:data="data"
65
:placeholder="$t('common.field.searchPlaceholder')"
76
field="title"
@@ -29,11 +28,6 @@
2928
</div>
3029
</template>
3130

32-
<!-- <template slot="empty">-->
33-
<!-- <span v-show="data.length === 0"-->
34-
<!-- class="has-text-grey has-text-centered"> {{$t('topNavbar.search.footer')}} </span>-->
35-
<!-- </template>-->
36-
3731
<template slot="header">
3832
<div>
3933
<b-button type="is-text" icon-left="toy-brick-search-outline" @click="gotoSearchPage">
@@ -88,28 +82,34 @@ export default class SearchBar extends Vue {
8882
})
8983
}
9084
85+
clearOldSearchData () {
86+
this.data = []
87+
this.page = 1
88+
this.totalPages = 1
89+
}
90+
9191
searchByName (newQuery: string) {
9292
if (!this.authUser) {
9393
return showWarningToaster(this.$t('notification.search.notAllowedToSearch'))
9494
}
95-
// String update
96-
if (this.query !== newQuery) {
97-
this.query = newQuery
98-
this.data = []
99-
this.page = 1
100-
this.totalPages = 1
101-
}
102-
// String cleared
95+
96+
// String cleared, don't search
10397
if (!newQuery.length) {
104-
this.data = []
105-
this.page = 1
106-
this.totalPages = 1
98+
this.clearOldSearchData()
10799
return
108100
}
101+
102+
// String update, refresh search
103+
if (this.query !== newQuery) {
104+
this.query = newQuery
105+
this.clearOldSearchData()
106+
}
107+
109108
// Reached last page
110109
if (this.page > this.totalPages) {
111110
return
112111
}
112+
113113
this.isFetching = true
114114
searchUsers(newQuery, this.page, 5)
115115
.then((pagingResponse) => {
@@ -132,7 +132,6 @@ export default class SearchBar extends Vue {
132132
query
133133
? await this.$router.push(getPageRouteWithQuery(Routes.SEARCH, query))
134134
: await this.$router.push(Routes.SEARCH)
135-
console.log('gotoSearchPage', this.query)
136135
}
137136
138137
async gotoProfile (username: string) {

src/plugins/fire-init-plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const getAuthProvider = (providerType: ProviderType) => {
3232

3333
default:
3434
throw new Error(
35-
'No social auth provider for provider type' + providerType
35+
`No social auth provider for provider type ${providerType}`
3636
)
3737
}
3838
}

src/service/firebase/firestore/user-collection.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,10 @@ export const userIncludes = (user: User, query: string) => {
8080
if (!query) {
8181
return true
8282
}
83-
return user.username?.toLowerCase().includes(query) ||
84-
user.name?.toLowerCase().includes(query) ||
85-
user.surname?.toLowerCase().includes(query)
83+
const queryLower = query.toLowerCase()
84+
return user.username?.toLowerCase().includes(queryLower) ||
85+
user.name?.toLowerCase().includes(queryLower) ||
86+
user.surname?.toLowerCase().includes(queryLower)
8687
}
8788

8889
export const toSearchDataPagingResponse = (filteredUsers: User[], page: number, limit: number): PagingResponse<SearchData> => {

0 commit comments

Comments
 (0)