Fix: Show follow alert after follower was cleared

This commit is contained in:
Knut Ahlers 2020-11-23 11:39:09 +01:00
parent 11e898ab99
commit 79fd31ec4e
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -38,6 +38,7 @@ const app = new Vue({
avail: false, avail: false,
backoff: 100, backoff: 100,
}, },
firstLoad: true,
sound: null, sound: null,
store: {}, store: {},
socket: null, socket: null,
@ -92,6 +93,7 @@ const app = new Vue({
case 'store': case 'store':
this.store = data.payload this.store = data.payload
window.setTimeout(() => { this.firstLoad = false }, 100) // Delayed to let the watches trigger
break break
default: default:
@ -107,11 +109,11 @@ const app = new Vue({
watch: { watch: {
'store.followers.last'(to, from) { 'store.followers.last'(to, from) {
if (!from || !to) { if (this.firstLoad || !to) {
// Initial load // Initial load or no follower
return return
} }
this.showAlert('New Follower', `${to} just followed`) this.showAlert('New Follower', `${to} just followed`, 'success')
this.playSound('/public/doorbell.webm') this.playSound('/public/doorbell.webm')
}, },