Add settings for user search
This commit is contained in:
parent
85ff67ff1c
commit
6d83bf6f58
4 changed files with 29 additions and 9 deletions
|
@ -1,8 +1,14 @@
|
|||
import AbstractModel from './abstractModel'
|
||||
import UserSettingsModel from '@/models/userSettings'
|
||||
|
||||
export default class UserModel extends AbstractModel {
|
||||
constructor(data) {
|
||||
super(data)
|
||||
|
||||
if (this.settings !== null) {
|
||||
this.settings = new UserSettingsModel(this.settings)
|
||||
}
|
||||
|
||||
this.created = new Date(this.created)
|
||||
this.updated = new Date(this.updated)
|
||||
}
|
||||
|
@ -15,6 +21,7 @@ export default class UserModel extends AbstractModel {
|
|||
name: '',
|
||||
created: null,
|
||||
updated: null,
|
||||
settings: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ export default class UserSettingsModel extends AbstractModel {
|
|||
return {
|
||||
name: '',
|
||||
emailRemindersEnabled: true,
|
||||
discoverableByName: false,
|
||||
discoverableByEmail: false,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ export default {
|
|||
needsTotpPasscode: false,
|
||||
avatarUrl: '',
|
||||
lastUserInfoRefresh: null,
|
||||
settings: {},
|
||||
}),
|
||||
mutations: {
|
||||
info(state, info) {
|
||||
|
@ -18,10 +19,12 @@ export default {
|
|||
if (info !== null) {
|
||||
state.avatarUrl = info.getAvatarUrl()
|
||||
}
|
||||
if (info.settings) {
|
||||
state.settings = info.settings
|
||||
}
|
||||
},
|
||||
setUserSettings(state, {name, emailRemindersEnabled}) {
|
||||
state.info.name = name
|
||||
state.info.emailRemindersEnabled = emailRemindersEnabled
|
||||
setUserSettings(state, settings) {
|
||||
state.settings = settings
|
||||
},
|
||||
authenticated(state, authenticated) {
|
||||
state.authenticated = authenticated
|
||||
|
@ -190,7 +193,6 @@ export default {
|
|||
info.type = ctx.state.info.type
|
||||
info.email = ctx.state.info.email
|
||||
info.exp = ctx.state.info.exp
|
||||
info.emailRemindersEnabled = ctx.state.info.emailRemindersEnabled
|
||||
|
||||
ctx.commit('info', info)
|
||||
ctx.commit('authenticated', authenticated)
|
||||
|
|
|
@ -108,6 +108,18 @@
|
|||
Send me Reminders for tasks via Email
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" v-model="settings.discoverableByName"/>
|
||||
Let other users find me when they search for my name
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" v-model="settings.discoverableByEmail"/>
|
||||
Let other users find me when they search for my full email
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" v-model="playSoundWhenDone"/>
|
||||
|
@ -276,10 +288,7 @@ export default {
|
|||
this.totp = new TotpModel()
|
||||
|
||||
this.userSettingsService = new UserSettingsService()
|
||||
this.settings = new UserSettingsModel({
|
||||
name: this.$store.state.auth.info.name,
|
||||
emailRemindersEnabled: this.$store.state.auth.info.emailRemindersEnabled ?? false,
|
||||
})
|
||||
this.settings = this.$store.state.auth.settings
|
||||
|
||||
this.playSoundWhenDone = localStorage.getItem(playSoundWhenDoneKey) === 'true' || localStorage.getItem(playSoundWhenDoneKey) === null
|
||||
|
||||
|
|
Loading…
Reference in a new issue